I have a DropDownListBox with the AutoPostBack="true" on a RadWindow, it is also defined as an AsyncPostBackTrigger inside the UpdatePanel of the RadWindow.
<
asp:DropDownList
ID
=
"ddlAttachDocType"
runat
=
"server"
CausesValidation
=
"false"
DataTextField
=
"LookUpTypeDescription"
DataValueField
=
"LookUpTypeValue"
Width
=
"300"
OnSelectedIndexChanged
=
"ddlAttachDocType_SelectedIndexChanged"
AutoPostBack
=
"true"
/>
<
asp:AsyncPostBackTrigger
ControlID
=
"ddlAttachDocType"
EventName
=
"SelectedIndexChanged"
/>
When the SelectedIndexChange event fires my RadWindow closes.
What am I missing? I need to hide/display certain div's on the page based on the SelectedIndexChange value.
Rodney
3 Answers, 1 is accepted
Hi Rodney,
The most likely reason for such behavior is that the RadWindow itself is included in the partial page rendering and gets disposed: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/how-to/how-to-use-radwindow-with-ajax. As the article explains, make sure the RadWindow itself does not get disposed, only the UpdatePanel inside its ContentTemplate should be part of the server response (and/or any other parts of the page that do not include the RadWIndow).
Another option is to register a script call that will show the RadWindow after the postback from the SelectedIndexChanged event: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/troubleshooting/opening-from-the-server.
Regards,
Telerik
Great,
I was unable to get the first solution to work but was able to get it to work by reposting the RadWindow in the SelectedIndexChange event. But that has introduced a second problem.
One of the objects on the radWindow is a RadAsyncUpload control. If I select the filename first, when I redisplay the window it has lost the file that was selected. Interestingly none of the other text or date fields on the page have this problem, they all retain their values.
Any help would be appreciated. I'm going to post the whole RadWindow below which is rather lengthy, but maybe you will see something I'm missing.
<
telerik:RadWindow
RenderMode
=
"Classic"
runat
=
"server"
ID
=
"rwDetailHeaderAttachment"
Modal
=
"true"
Behaviors
=
"Close, Move"
Title
=
"Add Attachment"
Skin
=
"Telerik"
EnableShadow
=
"true"
Width
=
"650px"
Height
=
"465px"
>
<
ContentTemplate
>
<
asp:UpdatePanel
ID
=
"updAttachment"
runat
=
"server"
UpdateMode
=
"Conditional"
>
<
ContentTemplate
>
<
asp:HiddenField
ID
=
"hdnPopupMode"
runat
=
"server"
Value
=
"ADD"
/>
<
div
class
=
"contentPadding"
>
<
div
class
=
"formRow"
id
=
"divAttachFile"
runat
=
"server"
style
=
"height: 60px; margin: 20px 0 20px 0;"
>
<
div
class
=
"floatLeft"
>
<
label
for
=
"asyncFlUpldAttachment"
><
span
id
=
"spnUploadFileMark"
runat
=
"server"
class
=
"validator"
>*</
span
> Upload File: </
label
>
<
telerik:RadAsyncUpload
ID
=
"RadAsyncUpload1"
runat
=
"server"
MaxFileSize='<%$ AppSettings:MAXATTCHFILESIZE %>'
MultipleFileSelection="Disabled" MaxFileInputsCount="1" AllowedFileExtensions='<%$ AppSettings:ATTCHFILEEXTNS %>'
EnableInlineProgress="true" TemporaryFileExpiration="36000"
OnClientValidationFailed="validationFailed"
OnClientFileUploading="fileUploading"
OnClientFileUploadFailed="fileUploadFailed">
</
telerik:RadAsyncUpload
>
<
span
id
=
"ErrorHolder"
style
=
"display: none"
class
=
"validator"
></
span
>
<
asp:CustomValidator
ID
=
"asyncFlUpldAttachmentValidator"
runat
=
"server"
CssClass
=
"validator"
Text
=
"Required"
ErrorMessage
=
"File is a Required Field"
OnServerValidate
=
"asyncFlUpldAttachmentValidator_Validate"
ValidationGroup
=
"attachmentValidations"
>
</
asp:CustomValidator
>
</
div
>
</
div
>
<
div
class
=
"formRow"
style
=
"margin-bottom: 8px;"
>
<
div
class
=
"floatLeft"
>
<
label
for
=
"lblAttachFileName"
><
span
id
=
"spnFileNameMark"
runat
=
"server"
class
=
"validator"
>*</
span
> File Name:</
label
>
<
asp:TextBox
ID
=
"txtBxAttachFileName"
runat
=
"server"
/>
<
asp:Label
ID
=
"lblAttachFileName"
runat
=
"server"
Width
=
"300"
/>
<
asp:RequiredFieldValidator
ID
=
"txtBxAttachFileName_ReqFieldValidator"
runat
=
"server"
CssClass
=
"validator"
Text
=
"Required"
ErrorMessage
=
"File Name is a Required Field"
ControlToValidate
=
"txtBxAttachFileName"
EnableClientScript
=
"true"
ValidationGroup
=
"attachmentValidations"
>
</
asp:RequiredFieldValidator
>
</
div
>
</
div
>
<
div
class
=
"formRow"
style
=
"margin-bottom: 8px;"
>
<
div
class
=
"floatLeft"
>
<
label
for
=
"lblAttachDocType"
><
span
id
=
"spnDocumentTypeMark"
runat
=
"server"
class
=
"validator"
>*</
span
> Document Type:</
label
>
<
asp:DropDownList
ID
=
"ddlAttachDocType"
runat
=
"server"
CausesValidation
=
"false"
DataTextField
=
"LookUpTypeDescription"
DataValueField
=
"LookUpTypeValue"
Width
=
"300"
OnSelectedIndexChanged
=
"ddlAttachDocType_SelectedIndexChanged"
AutoPostBack
=
"true"
/>
<
asp:RequiredFieldValidator
ID
=
"ddlAttachDocType_RequiredFieldValidator"
runat
=
"server"
CssClass
=
"validator"
Text
=
"Required"
ErrorMessage
=
"Document Type is a Required Field"
ControlToValidate
=
"ddlAttachDocType"
EnableClientScript
=
"true"
Display
=
"Dynamic"
ValidationGroup
=
"attachmentValidations"
>
</
asp:RequiredFieldValidator
>
<
asp:Label
ID
=
"lblAttachDocType"
runat
=
"server"
Width
=
"300"
/>
</
div
>
</
div
>
<
div
class
=
"formRow"
id
=
"spnPubCode"
runat
=
"server"
style
=
"display: none; margin-bottom: 8px;"
>
<
div
class
=
"floatLeft"
>
<
label
for
=
"lblAttachPublicationCode"
><
span
class
=
"validator"
>*</
span
> Publication Code:</
label
>
<
asp:DropDownList
ID
=
"ddlAttachPublicationCode"
runat
=
"server"
DataTextField
=
"LookUpTypeDescription"
DataValueField
=
"LookUpTypeValue"
/>
<
asp:Label
ID
=
"lblAttachPublicationCode"
runat
=
"server"
/>
</
div
>
</
div
>
<
div
class
=
"formRow"
id
=
"spnPubName"
runat
=
"server"
style
=
"display: none; margin-bottom: 8px;"
>
<
div
class
=
"floatLeft"
>
<
label
for
=
"lblAttachPublicationName"
><
span
class
=
"validator"
>*</
span
> Publication Name:</
label
>
<
asp:TextBox
ID
=
"txtPublicationName"
runat
=
"server"
MaxLength
=
"200"
/>
<
asp:CustomValidator
ID
=
"txtPublicationName_CustomValidator"
runat
=
"server"
CssClass
=
"validator"
Text
=
"Required"
ErrorMessage
=
"Publication Name is a Required Field"
OnServerValidate
=
"txtPublicationName_CustomValidator_Validate"
Display
=
"Dynamic"
ClientValidationFunction
=
"validatePublicationName"
ValidationGroup
=
"attachmentValidations"
>
</
asp:CustomValidator
>
<
asp:Label
ID
=
"lblAttachPublicationName"
runat
=
"server"
/>
</
div
>
</
div
>
<
div
class
=
"formRow"
id
=
"spnPubDispo"
runat
=
"server"
style
=
"display: none; margin-bottom: 8px;"
>
<
div
class
=
"floatLeft"
>
<
label
for
=
"lblAttachDisposition"
><
span
class
=
"validator"
>*</
span
> Disposition:</
label
>
<
asp:DropDownList
ID
=
"ddlAttachDisposition"
runat
=
"server"
DataTextField
=
"LookUpTypeDescription"
DataValueField
=
"LookUpTypeValue"
/>
<
asp:Label
ID
=
"lblAttachDisposition"
runat
=
"server"
/>
</
div
>
</
div
>
<
div
class
=
"formRow"
style
=
"margin-bottom: 8px;"
>
<
div
class
=
"floatLeft"
>
<
label
for
=
"lblAttachDocumentDate"
>Document Date:</
label
>
<
telerik:RadDatePicker
runat
=
"server"
ID
=
"rdpAttachDocumentDate"
ZIndex
=
"100000"
>
<
DateInput
runat
=
"server"
DateFormat
=
"dd MMM yyyy"
DisplayDateFormat
=
"dd MMM yyyy"
EmptyMessage
=
"DD MMM YYYY"
/>
<
Calendar
ID
=
"Calendar1"
runat
=
"server"
ShowRowHeaders
=
"false"
>
<
SpecialDays
>
<
telerik:RadCalendarDay
Repeatable
=
"Today"
Date
=
""
IsToday
=
"true"
>
<
ItemStyle
CssClass
=
"rcToday"
/>
</
telerik:RadCalendarDay
>
</
SpecialDays
>
</
Calendar
>
</
telerik:RadDatePicker
>
<
asp:Label
ID
=
"lblAttachDocumentDate"
runat
=
"server"
/>
</
div
>
</
div
>
<
div
class
=
"formRow"
style
=
"margin-bottom: 15px;"
>
<
label
for
=
"txtAttachmentComments"
>Comments:</
label
>
<
div
style
=
"width:100%"
>
<
telerik:RadEditor
ID
=
"txtBxAttachmentComments"
runat
=
"server"
EditModes
=
"Design"
MaxTextLength
=
"4000"
SkinID
=
"DefaultSetOfTools"
ContentAreaMode
=
"Div"
OnClientInit
=
"CharCountInit"
Height
=
"140px"
Width
=
"65%"
Style
=
"background-color: White; display: inline-block;"
Skin
=
"Default"
Visible
=
"true"
TabIndex
=
"170"
>
<
Tools
>
<
telerik:EditorToolGroup
>
<
telerik:EditorTool
Name
=
"AjaxSpellCheck"
/>
<
telerik:EditorSeparator
/>
<
telerik:EditorTool
Name
=
"Cut"
/>
<
telerik:EditorTool
Name
=
"Copy"
/>
<
telerik:EditorTool
Name
=
"Paste"
/>
</
telerik:EditorToolGroup
>
</
Tools
>
<
Modules
>
<
telerik:EditorModule
Name
=
"RadEditorStatistics"
Visible
=
"true"
Enabled
=
"true"
></
telerik:EditorModule
>
</
Modules
>
</
telerik:RadEditor
>
</
div
>
</
div
>
<
div
class
=
"formRow"
>
<
div
class
=
"floatRight"
>
<
asp:LinkButton
ID
=
"lnkBtnSaveAttachment"
runat
=
"server"
OnClick
=
"lnkBtnSaveAttachment_Click"
CssClass
=
"silverButton"
CausesValidation
=
"true"
> <
span
>Submit</
span
></
asp:LinkButton
>
<
asp:LinkButton
ID
=
"lnkBtnAttachmentCancel"
runat
=
"server"
CausesValidation
=
"false"
Text
=
"Cancel"
CssClass
=
"floatRightLink"
OnClick
=
"lnkBtnAttachmentCancel_Click"
/>
</
div
>
</
div
>
<
div
class
=
"formRowNoBorder"
style
=
"margin-top: 8px;"
>
<
div
class
=
"floatLeft"
>
<
asp:Label
ID
=
"errorMessage"
runat
=
"server"
Visible
=
"false"
CssClass
=
"validator"
/>
</
div
>
</
div
>
</
div
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
</
ContentTemplate
>
</
telerik:RadWindow
>
Hello Rodney,
The AJAX setup issue is likely to be outside of the RadWindow, it may even be as high as the master page level.
What I would first suggest is that you reconsider whether you need to use the ContentTemplate. If you load an entire ASPX page in the RadWindow it will be loaded in an iframe and will be able to operate independently from the main page. If you need it to talk to the main page, call a JS function as shown here.
As for the AsyncUpload, I suggest you try using the PostbackTriggers property so it retains the files, as explained in the documentation: http://docs.telerik.com/devtools/aspnet-ajax/controls/asyncupload/how-to/how-to-persist-uploaded-files.
Regards,
Telerik