Hello,
I am posting a simplified version of my code to demonstrate the problem I am having.
If I click on a menu item, one window opens.
Then, if I click on another menu item, TWO window open. Following clicks cause two windows to open.
I only want one window to open at a time.
If I remove ajax, it works fine.
It seems like Sys.Application.add_load(OpenWindow1) is not being rendered on the page. Not sure why.
Please help.
Thanks,
Simone
cs:
aspx:
I am posting a simplified version of my code to demonstrate the problem I am having.
If I click on a menu item, one window opens.
Then, if I click on another menu item, TWO window open. Following clicks cause two windows to open.
I only want one window to open at a time.
If I remove ajax, it works fine.
It seems like Sys.Application.add_load(OpenWindow1) is not being rendered on the page. Not sure why.
Please help.
Thanks,
Simone
cs:
protected void Page_Load(object sender, EventArgs e)
{
}
protected void subMenu_ItemClick(object sender, RadMenuEventArgs e)
{
switch (e.Item.Value)
{
case "Window1":
{
if (!ClientScript.IsStartupScriptRegistered("OpenStartupWindow1"))
ScriptManager.RegisterStartupScript(this, this.GetType(), "OpenStartupWindow1", "Sys.Application.add_load(OpenWindow1);", true);
}
break;
case "Window2":
{
if (!ClientScript.IsStartupScriptRegistered("OpenStartupWindow2"))
ScriptManager.RegisterStartupScript(this, this.GetType(), "OpenStartupWindow2", "Sys.Application.add_load(OpenWindow2);", true);
}
break;
}
}
}
aspx:
<
body
>
<
div
id
=
"div1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function OpenWindow1() {
var oWnd = radopen("WebForm1.aspx", "wndWebForm1");
}
function OpenWindow2() {
var oWnd = radopen("WebForm2.aspx", "wndWebForm2");
}
</
script
>
</
div
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadWindowManager
ID
=
"RadWindowManagerEmails"
ShowContentDuringLoad
=
"false"
VisibleStatusbar
=
"false"
runat
=
"server"
EnableShadow
=
"true"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"wndWebForm1"
runat
=
"server"
Behaviors
=
"Close,Move,Resize"
Width
=
"1100"
Height
=
"600"
NavigateUrl
=
"WebForm1.aspx"
>
</
telerik:RadWindow
>
<
telerik:RadWindow
ID
=
"wndWebForm2"
runat
=
"server"
Behaviors
=
"Close,Move,Resize"
Width
=
"600"
Height
=
"600"
NavigateUrl
=
"WebForm2.aspx"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
<
telerik:RadAjaxManager
runat
=
"Server"
ID
=
"RadAjaxManager1"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"subMenu"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"txt1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
div
style
=
"display: block; width: 100%; height: 30px;"
>
<
telerik:RadMenu
ID
=
"subMenu"
runat
=
"server"
EnableViewState
=
"false"
Orientation
=
"Horizontal"
SkipLinkText
=
""
CausesValidation
=
"true"
OnItemClick
=
"subMenu_ItemClick"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Open Window 1"
Value
=
"Window1"
/>
<
telerik:RadMenuItem
Text
=
"Open Window 2"
Value
=
"Window2"
/>
</
Items
>
</
telerik:RadMenu
>
</
div
>
<
telerik:RadTextBox
ID
=
"txt1"
runat
=
"server"
Width
=
"400px"
>
</
telerik:RadTextBox
>
</
form
>
</
body
>