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

window loading on postback

1 Answer 53 Views
Window
This is a migrated thread and some comments may be shown as answers.
Sigma
Top achievements
Rank 1
Sigma asked on 21 Aug 2012, 05:32 AM
Hi,

I have a radgrid in my application in which i am opening a RadWindow in button click from the server side to show a pop up. But whenever the page refreshes the window is loading again. How can i resolve this issue.

Anybody please help me asap..
Sigma.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 Aug 2012, 05:55 AM
Hi,

This issue arises when you are setting VisibleOnPageLoad as true which causes window to appear on each postback. One suggestion is that you can open the window from client side as well as server side as shown below.
  1. Client side:
aspx:
<asp:Button ID="Button1" runat="server" Text="Open" OnClientClick="OnClientClick();return false;" />
JS:
<script type="text/javascript">
    function OnClientClick()
    {
        var oWnd = $find("<%= RadWindow1.ClientID %>");
        oWnd.show();
     }
</script>
2. Server side:
protected void Button2_Click(object sender, EventArgs e)
   {
       string script = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
       ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); 
   }

Thanks,
Shinu.
Tags
Window
Asked by
Sigma
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or