Failed to load viewstate

M

max_weinland

Hello,

the following short ASP.NET 2.0 page fails with error "Failed to load
viewstate".
Can someone please tell me why?

To reproduce the error, click the button, then click "Cancel", then
click the button again.

Thank you,
Max Weinland.



<%@ Page Language="C#" %>
<script runat="server">
protected void DetailsView1_ModeChanging(object sender,
DetailsViewModeEventArgs e)
{
MultiView1.ActiveViewIndex = 0;
}
protected void Button1_Click(object sender, EventArgs e)
{
DetailsView1.ChangeMode(DetailsViewMode.Edit);
MultiView1.ActiveViewIndex = 1;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<form id="form1" runat="server">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
</asp:View>
<asp:View ID="View2" runat="server">
<asp:DetailsView ID="DetailsView1" runat="server"
AutoGenerateRows="False"
DataSourceID="XmlDataSource1"
OnModeChanging="DetailsView1_ModeChanging"
AutoGenerateEditButton="True">
<Fields>
<asp:TemplateField>
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server">
<Data><Table><Row></Row></Table></Data>
</asp:XmlDataSource>
</asp:View>
</asp:MultiView>
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top