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

Radwindow popup

4 Answers 127 Views
Window
This is a migrated thread and some comments may be shown as answers.
Gauri
Top achievements
Rank 1
Gauri asked on 25 Mar 2013, 04:33 PM
I have a webpage that has two buttons.
Button 1 : When you click on this button it opens up a modal window.
Button 2: Is to save the page data.

Scenario: When We click on Button1 it opens up a modal window..
 Then We close the window using windows close icon. (X)
 Then when we save the page(By clicking on button 2) 
 The modal window popus up again.

Please advise how can I avoid poping up the modal window on save button click.

Here is the code of Button1 click event

   protected void Button1_Click(object sender, EventArgs e)
    {
        RadWindow _menuwindow = new RadWindow();
        _menuwindow.NavigateUrl = "~/Console/L/Details.aspx";
        _menuwindow.VisibleOnPageLoad = true;
        _menuwindow.ShowContentDuringLoad = true;
        _menuwindow.Style.Value = "z-index:7010;";
        _menuwindow.ID = "Button1";
        _menuwindow.Modal = true;
        _menuwindow.Height = 600;
        _menuwindow.Width = 900;
        _menuwindow.DestroyOnClose = true;
        _menuwindow.Title = "Button1";
        CathWindowManager.Windows.Add(_menuwindow);
    }

Thanks.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Mar 2013, 05:27 AM
Hi,

The Radwindow pops up on postback because VisibleOnPageLoad is set to true. Try opening the window as shown below.
C#:
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
0
Gauri
Top achievements
Rank 1
answered on 26 Mar 2013, 12:44 PM
Thanks Shinu, for always trying to help.

But when I add the code snippet to my code I get error.
So I moved the radwindow declaration to the page instead of to Button2 click.

I get following error on Button1 click

Microsoft JScript runtime error: Unable to get value of the property 'show': object is null or undefined

I noticed that the menuwindow clientId was empty on the genearted script.
So I moved the radwindow from class to aspx page.

Now I don't get error but it opens my window plus an additional window.

Any help is much appreciated.
0
Shinu
Top achievements
Rank 2
answered on 27 Mar 2013, 06:26 AM
Hi,

Please make sure that you have RadWindowManager on the page.
aspx:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
Also check the following help documentation for more.
Wrong RadWindow Is Opened

Thanks,
Shinu
0
Gauri
Top achievements
Rank 1
answered on 28 Mar 2013, 06:11 PM
Thanks Shinu.
The article was very helpful.
Tags
Window
Asked by
Gauri
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Gauri
Top achievements
Rank 1
Share this question
or