RadWindow: Opening windows from C#

G18Programmer picture G18Programmer · May 16, 2011 · Viewed 16.8k times · Source

Need to open a webpage in a radWindow from a button click event. Attempted to do this from client side but, it appears and then immediately disappears. I Think the button click is causing a postback to the server... Therefore, I'm currently attempting to solve this issue with server side code (C#) posted below.

Problem: Need to open rad windows without adding them to the window collection or remove them from the window collection on close. They aren't being removed from the window collection on closing of the rad window. This results in the same window opening for the number of times the new button is pressed. First click opens one window, the second time the new button is clicked two windows open, etc... Any ideas?

C# - Multiple pages opening

    RadWindow newWindow = new RadWindow();
    newWindow.NavigateUrl = "WebPage.aspx";
    newWindow.Top = Unit.Pixel(22);
    newWindow.VisibleOnPageLoad = true;
    newWindow.Modal = true;
    newWindow.Left = Unit.Pixel(0);
    newWindow.Height = 530;
    newWindow.Width = 1000;
    winMgr.Windows.Add(newWindow);

JavaScript - Post Back issue? Page opens and immediately disappears.

    var oManager = '<%=winMgr.ClientID %>';
    var oManager = window.radopen("WebPage.aspx", null);
    oManager.setSize(1000, 530); //Width, Height
    oManager.center();
    oManager.SetActive();

Thanks for your help!

Answer

Santhosh Kumar Gudise picture Santhosh Kumar Gudise · Dec 15, 2011

As per Alison's solution, rad window is getting displayed on button click; but is disappearing again immediately. I tried using the code below. It is working fine in my case.

<script type="text/javascript">
    function openRadWin()
    {
        radopen("http://www.google.com", "RadWindow1");
    }
</script>
<asp:Button ID="Button1" Text="Show Window" runat="server" OnClientClick="openRadWin();"  />

Hope, it will be useful for someone.