Failing to open rad Window from code behind

2 posts, 0 answers
  1. newguy
    newguy avatar
    26 posts
    Member since:
    May 2013

    Posted 08 Oct 2013 Link to this post

    Hi Guys,

    I need to open a rad window on a button click but only if the correct condition has been met.
    I am trying to open my Rad Window with C# code behind by calling a javascript function.

    The window i am trying to open has its own controls on it.

    JS i am using to open the Rad Window
    // shows the notificationForm on the new incident page.
                function showNotification() {
                      var oWnd = radopen("Notify.aspx", "Notifications", "740", "200");
                }

    Rad Window which is declared on the page where i am clicking the button
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
            <Windows>
     
            <telerik:RadWindow  ID="Notifications" runat="server" Title="Notifications" Modal="true" ShowContentDuringLoad="false" ReloadOnShow="True" ViewStateMode="Enabled"
                                VisibleStatusbar="false"  Behavior="None" Behaviors="None" VisibleTitlebar="false" >
            </telerik:RadWindow>
     
        </Windows>
    </telerik:RadWindowManager>

    C# code behind button click
    protected void btnSave_Click(object sender, EventArgs e)
       {
           if (HasNotifications)
           {
              // Do something
           }
           else
            {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "showNotification();", true);
            }
    }

    it seems like the window wants to open but closes immediately.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Oct 2013 Link to this post

    Hi newguy,

    Please try the following C# code snippet that I tried. Please go through this documentation.

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
    {
        string radalertscript = "<script language='javascript'>function (){radalert('Welcome to RadWindow for <strong>ASP.NET AJAX</strong>!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top