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

Failing to open rad Window from code behind

1 Answer 101 Views
Window
This is a migrated thread and some comments may be shown as answers.
newguy
Top achievements
Rank 1
newguy asked on 08 Oct 2013, 09:32 AM
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.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Oct 2013, 12:02 PM
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.
Tags
Window
Asked by
newguy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or