In my ASP.NET 4.0 project, I have many RadWindow-powered dialog boxes that are defined like this partial code example:
To turn them on/off I use server-side code like this:
That all works fine. But now I'm trying to introduce a title to such a dialog, which I will dynamically generate depending on various factors. For example, for the Change Password dialog box above, I might have a title like "Changing Password for John Smith".
I tried doing this by simply setting the Title property of the RadWindow before activating the dialog box. Here's an example:
This didn't work though. No matter what I tried, the title always remained blank.
So how does one dynamically set the Title of a RadWindow?
Robert
<
telerik:RadWindow
ID
=
"rwChangePassword"
runat
=
"server"
Behaviors
=
"Close,Move"
EnableShadow
=
"true"
VisibleStatusbar
=
"false"
VisibleTitlebar
=
"true"
AutoSize
=
"true"
Modal
=
"true"
>
<
ContentTemplate
>
<
div
class
=
"dialogMain smallText"
style
=
"width:330px"
>
<
asp:UpdatePanel
ID
=
"UpdatePanel2"
runat
=
"server"
>
<
ContentTemplate
>
<
div
style
=
"margin:10px 0 0 5px"
>
<
div
style
=
"width:95%"
>
Please enter the user's new password, enter it a second time to confirm, and then press OK:
</
div
>
.
.
.
To turn them on/off I use server-side code like this:
public
bool
ModalDialogIsActive
{
get
{
return
Convert.ToBoolean(ViewState[
"ModalDialogIsActive"
]);
// Note: Returns 'false' if the value is 'null'
}
set
{
if
(value)
Website.Common.ShowDialog(rwChangePassword);
else
Website.Common.HideDialog(rwChangePassword);
ViewState[
"ModalDialogIsActive"
] = value;
}
}
That all works fine. But now I'm trying to introduce a title to such a dialog, which I will dynamically generate depending on various factors. For example, for the Change Password dialog box above, I might have a title like "Changing Password for John Smith".
I tried doing this by simply setting the Title property of the RadWindow before activating the dialog box. Here's an example:
rwChangePassword.Title =
"Changing Password for "
+ userName;
ModalDialogIsActive =
true
;
This didn't work though. No matter what I tried, the title always remained blank.
So how does one dynamically set the Title of a RadWindow?
Robert