Radwindow popup

5 posts, 0 answers
  1. Gauri
    Gauri avatar
    23 posts
    Member since:
    Jan 2012

    Posted 25 Mar 2013 Link to this post

    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.

  2. Shinu
    Shinu avatar
    17004 posts
    Member since:
    Mar 2007

    Posted 26 Mar 2013 Link to this post

    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

  3. Gauri
    Gauri avatar
    23 posts
    Member since:
    Jan 2012

    Posted 26 Mar 2013 Link to this post

    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.

  4. Shinu
    Shinu avatar
    17004 posts
    Member since:
    Mar 2007

    Posted 27 Mar 2013 Link to this post

    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

  5. Gauri
    Gauri avatar
    23 posts
    Member since:
    Jan 2012

    Posted 28 Mar 2013 Link to this post

    Thanks Shinu.
    The article was very helpful.

Back to Top