Hi
I have been through these forums and found lots of similar examples but none that quite fix my problem.
I have a rad window with a content template that pops up on click of a button.
The user must complete certain things that are checked on the server within the rad window unless an error message is shown, otherwise the details added are saved and the window needs to close.
My problem is my rad window doesn't close!
This is my radwindow
I am using an ajax manager to try and control the autopopulation of my dropdowns and btnAddDetail with the error message.
When I click the btnAddDetail
I run this function
This is my javascript to close the window:
Can anyone help with my my window won't close? I know its something to do with how I've used the ajax but I can't work out what!
Bex
I have been through these forums and found lots of similar examples but none that quite fix my problem.
I have a rad window with a content template that pops up on click of a button.
The user must complete certain things that are checked on the server within the rad window unless an error message is shown, otherwise the details added are saved and the window needs to close.
My problem is my rad window doesn't close!
This is my radwindow
<
telerik:RadWindowManager
ID
=
"Radwindowmanager1"
runat
=
"server"
>
<
Windows
>
<
telerik:RadWindow
runat
=
"server"
ID
=
"winDetail"
Width
=
"400px"
Height
=
"400px"
ReloadOnShow
=
"true"
ShowContentDuringLoad
=
"false"
Modal
=
"True"
Behaviors
=
"None"
VisibleTitlebar
=
"true"
VisibleStatusbar
=
"false"
>
<
ContentTemplate
>
<
h3
>
Injury Details
</
h3
>
<
asp:Label
runat
=
"server"
ID
=
"lblError"
></
asp:Label
>
<
div
class
=
"modalForm"
>
<
ol
>
<
li
>
<
label
class
=
"noFloatLabel"
>
Injury
</
label
>
<
telerik:RadComboBox
ID
=
"ddlName"
runat
=
"server"
AutoPostBack
=
"True"
OnSelectedIndexChanged
=
"ddlInjuryName_OnSelectedIndexChanged"
/>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"txtNewName"
>
</
telerik:RadTextBox
>
</
li
>
<
li
>
<
label
class
=
"noFloatLabel"
>
Specific Detail
</
label
>
<
telerik:RadComboBox
ID
=
"ddSpecific"
runat
=
"server"
/>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"txtNewSpecific"
>
</
telerik:RadTextBox
>
</
li
>
</
ol
>
</
div
>
<
br
/>
<
asp:Button
runat
=
"server"
ID
=
"btnAddDetail"
Text
=
"Add"
OnClick
=
"btnAddDetail_Click"
/>
<
asp:Button
runat
=
"server"
ID
=
"btnCancel"
Text
=
"Cancel"
OnClick
=
"btnCancel_Click"
/>
<
asp:HiddenField
runat
=
"server"
ID
=
"hdnId"
/>
</
ContentTemplate
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
I am using an ajax manager to try and control the autopopulation of my dropdowns and btnAddDetail with the error message.
<
telerik:RadAjaxManager
runat
=
"server"
ID
=
"aj1"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"ddlName"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"ddlSpecific"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"btnAddDetail"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"lblError"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
When I click the btnAddDetail
I run this function
protected
void
btnAddDetail_Click(
object
sender, EventArgs e)
{
if
((ddlName.SelectedValue !=
string
.Empty || txtNewName.Text !=
string
.Empty)
&& (ddlSpecific.SelectedValue !=
string
.Empty || txtNewSpecific.Text !=
string
.Empty))
{
//do processing if processing fails show error if not close window
string
script =
"function f(){Close(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
;
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"close"
, script,
true
);
}
else
{
lblError.Text =
"You must select a name and description"
;
}
}
This is my javascript to close the window:
function
GetRadWindow() {
var
oWindow =
null
;
if
(window.radWindow) oWindow = window.radWindow;
//Will work in Moz in all cases, including clasic dialog
else
if
(window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
//IE (and Moz az well)
return
oWindow;
}
function
Close() {
GetRadWindow().close();
}
Can anyone help with my my window won't close? I know its something to do with how I've used the ajax but I can't work out what!
Bex