This is a migrated thread and some comments may be shown as answers.

RadWindow closes immediately in non-IE7 browsers

3 Answers 140 Views
Window
This is a migrated thread and some comments may be shown as answers.
John Mann
Top achievements
Rank 1
John Mann asked on 08 Jul 2009, 07:11 PM

I have a page that pops up a RadWindow when a button is clicked. Works fine in IE7, but in IE8, Opera 9.64 and Chrome the window will flash up for just a moment and then close. The following code samples illustrate the problem.

Parent window:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestApp.WebForm1" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
  <title></title>  
  <script type="text/javascript">  
 
    function btnOpenRadWindow_onClick() {  
      var oManager = GetRadWindowManager();  
      oManager.open("WebForm2.aspx", "rwTest");  
    }  
 
    function ccbTest(sender, newText) {  
      // Do something here  
    }  
 
  </script> 
</head> 
<body> 
  <form id="form1" runat="server">  
  <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
  </telerik:RadScriptManager> 
  <div> 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Vista" Behavior="Default" InitialBehavior="None" Left="" Top="" Style="display: none;" VisibleStatusbar="False">  
      <Windows> 
        <telerik:RadWindow ID="rwTest" runat="server" Behavior="Resize, Close, Move" Behaviors="Resize, Close, Move" InitialBehavior="None" NavigateUrl="WebForm2.aspx" ClientCallBackFunction="ccbTest" Modal="true" ReloadOnShow="True" Style="display: none;" VisibleStatusbar="False" ShowContentDuringLoad="False" AutoSize="true">  
        </telerik:RadWindow> 
      </Windows> 
    </telerik:RadWindowManager> 
    <button id="btnOpenRadWindow" onclick="btnOpenRadWindow_onClick()">Open Window</button> 
  </div> 
  </form> 
</body> 
</html> 
 

Popup window:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="TestApp.WebForm2" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
  <title></title>  
  <script type="text/javascript">  
 
    function btnClose_onclick() {  
      var oWindow = GetRadWindow();  
      oWindow.argument = null;  
      oWindow.close(0);  
    }  
 
    function GetRadWindow() {  
      var oWindow = null;  
      if (window.radWindow)  
        oWindow = window.radWindow;  
      else if (window.frameElement.radWindow)  
        oWindow = window.frameElement.radWindow;  
      return oWindow;  
    }  
    
  </script> 
</head> 
<body> 
  <form id="form1" runat="server">  
  <div> 
    <button id="btnClose" onclick="return btnClose_onclick()" class="ButtonStandard">Cancel</button><br /> 
  </div> 
  </form> 
</body> 
</html> 
 

I'm sure I'm doing something wrong since your samples work in these other browsers, but I haven't been able to figure it out yet. Can you shed some light on this please?

John

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 09 Jul 2009, 04:20 AM
Hello John,

You need to cancel the postback in order to avoid that.
e.g.
<button id="btnOpenRadWindow" onclick="btnOpenRadWindow_onClick(); return false;">Open Window</button>


All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
John Mann
Top achievements
Rank 1
answered on 09 Jul 2009, 03:39 PM
Thank you, that fixed it. I figured it was something simple. I didn't realize that an HTML button caused a postback in these other browsers.

John
0
John Mann
Top achievements
Rank 1
answered on 10 Jul 2009, 09:28 PM
After further investigation I learned that the default type for an html button is submit. IE7 appears to ignore this, but the other browsers I tried will honor that default and cause a postback. Another solution to the problem is to change the button's type. The following will work properly.

<button id="btnOpenRadWindow" type="button" onclick="btnOpenRadWindow_onClick()">Open Window</button>

John
Tags
Window
Asked by
John Mann
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
John Mann
Top achievements
Rank 1
Share this question
or