I have created a sample page which is demonstrating the problem I am encountering. When you click the link on the page, it opens a radwindow. Within that radwindow, if you click on the link titled 'close me with argument' the window is closed with an argument, the javascript validates the argument then the page does a postback and the server time is displayed on the page. (I have a radgrid on the page, as this emulates what I am actually doing on my live page). Then after the page has posted back, if you open the radwindow again and simply close the window (click the X on the toolbar) the argument is still passed to the javascript function. How can i prevent this from happening? Below is my sample project using version Q3 2008. Thanks for your help!
Test.aspx (load me)
Test.aspx.vb
Test2.aspx
Test.aspx (load me)
| <%@ Page language="VB" CodeFile="test.aspx.vb" AutoEventWireup="false" Inherits="_test" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <title></title> |
| <script type="text/javascript"> |
| function ShowDeleteForm() |
| { |
| window.radopen("test2.aspx", "AdWindow"); |
| } |
| function OnClientClose(oWnd) |
| { |
| //get the transferred arguments |
| var arg = oWnd.argument; |
| if(arg) |
| { |
| if (arg.Value == 'true') { |
| __doPostBack("<%=RadGrid1.UniqueID%>", 'DeleteAd;12345'); |
| } |
| } |
| } |
| </script> |
| </head> |
| <body> |
| <form runat="server" id="mainForm" method="post"> |
| <asp:ScriptManager id="ScriptManager1" runat="server" /> |
| <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Vista"> |
| <Windows> |
| <telerik:RadWindow Skin="Vista" ID="AdWindow" runat="server" Height="200px" Width="400px" |
| Left="150px" ReloadOnShow="true" Modal="true" VisibleStatusbar="false" OnClientClose="OnClientClose" ShowContentDuringLoad="false" /> |
| </Windows> |
| </telerik:RadWindowManager> |
| <telerik:RadAjaxPanel |
| ID="RadAjaxPanel1" |
| runat="server" |
| LoadingPanelID="LoadingPanel1"> |
| <asp:UpdatePanel ID="UpdatePanel3" runat="server"> |
| <ContentTemplate> |
| <telerik:RadGrid ID="RadGrid1" runat="server"> |
| </telerik:RadGrid> |
| <asp:Literal ID="ltlContent" runat="server"></asp:Literal> |
| <br /><br /> |
| <a href="javascript:ShowDeleteForm();">click me</a> |
| </ContentTemplate> |
| </asp:UpdatePanel> |
| </telerik:RadAjaxPanel> |
| <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Transparency="35" BackColor="#E0E0E0"> |
| <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' |
| style="margin-top: 50px; margin-left: 0px; position:relative;" /> |
| </telerik:RadAjaxLoadingPanel> |
| </form> |
| </body> |
| </html> |
Test.aspx.vb
| Partial Class _test |
| Inherits System.Web.UI.Page |
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| If IsPostBack Then |
| Dim passedArgument As String = Request.Params.[Get]("__EVENTARGUMENT") |
| If Not (passedArgument Is Nothing) And passedArgument <> "" Then |
| If passedArgument.IndexOf("DeleteAd") <> -1 Then |
| Dim strArray As String() |
| strArray = passedArgument.Split(";") |
| postVal(strArray(1)) |
| End If |
| End If |
| End If |
| End Sub |
| Private Sub postVal(ByVal strVal As String) |
| ltlContent.Text = Date.Now & " - " & strVal |
| RadGrid1.Rebind() |
| End Sub |
| End Class |
Test2.aspx
| <%@ Page language="VB" AutoEventWireup="false" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <title></title> |
| <script type="text/javascript"> |
| function GetRadWindow() |
| { |
| var oWindow = null; |
| if (window.radWindow) oWindow = window.radWindow; |
| else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; |
| return oWindow; |
| } |
| function returnToParent(val) |
| { |
| var oArg = new Object(); |
| oArg.Value = val; |
| var oWnd = GetRadWindow(); |
| oWnd.argument = oArg; |
| oWnd.close(); |
| } |
| </script> |
| </head> |
| <body> |
| <form runat="server" id="mainForm" method="post"> |
| <a href="javascript:returnToParent('true');">close me with argument</a> |
| </form> |
| </body> |
| </html> |