Hell all,
I'm trying to open a RadWindow with some dynamic behavior inside the RadWindow (grids and forms). I created a sample project and am able to get the RadWindow open and update controls using Ajax by setting the EnableViewState to false on almost all the controls inside the RadWindow.
Now that I've added a Cancel button, I get the error:
Failed to load viewstate.
The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.
For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Here is the snippets to the sample project i created for test purposes:
The code behind looks like this:
Any help would be appreciated.
I'm trying to open a RadWindow with some dynamic behavior inside the RadWindow (grids and forms). I created a sample project and am able to get the RadWindow open and update controls using Ajax by setting the EnableViewState to false on almost all the controls inside the RadWindow.
Now that I've added a Cancel button, I get the error:
Failed to load viewstate.
The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.
For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Here is the snippets to the sample project i created for test purposes:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"btnGetDate"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"datePanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadToolBar1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"windowPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadToolBar
ID
=
"RadToolBar1"
Runat
=
"server"
onbuttonclick
=
"RadToolBar1_ButtonClick"
>
<
Items
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"Window"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
<
asp:Panel
ID
=
"windowPanel"
runat
=
"server"
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
>
</
telerik:RadWindowManager
>
<
telerik:RadWindow
ID
=
"RadWindow1"
runat
=
"server"
Modal
=
"true"
>
<
ContentTemplate
>
<
asp:Panel
ID
=
"datePanel"
runat
=
"server"
>
Date: <
asp:Literal
ID
=
"litDate"
runat
=
"server"
EnableViewState
=
"false"
></
asp:Literal
><
br
/>
<
asp:Button
ID
=
"btnGetDate"
runat
=
"server"
Text
=
"Update Date"
OnClick
=
"GetDate_Click"
EnableViewState
=
"false"
/>
<
br
/>
<
asp:Button
ID
=
"btnClose"
runat
=
"server"
Text
=
"Cancel"
OnClick
=
"btnClose_Click"
EnableViewState
=
"false"
/>
</
asp:Panel
>
</
ContentTemplate
>
</
telerik:RadWindow
>
</
asp:Panel
>
The code behind looks like this:
protected
void
RadToolBar1_ButtonClick(
object
sender, Telerik.Web.UI.RadToolBarEventArgs e)
{
RadWindow1.VisibleOnPageLoad =
true
;
RadWindowManager1.Controls.Add(RadWindow1);
litDate.Text =
"not set"
;
}
protected
void
GetDate_Click(
object
sender, EventArgs e)
{
litDate.Text = DateTime.Now.ToLongTimeString();
RadWindow1.VisibleOnPageLoad =
true
;
RadWindowManager1.Controls.Add(RadWindow1);
}
protected
void
btnClose_Click(
object
sender, EventArgs e)
{
RadWindow1.VisibleOnPageLoad =
false
;
RadWindowManager1.Controls.Remove(RadWindow1);
}
Any help would be appreciated.