Monday, March 26, 2012

treeview inside of updatepanel = Validation of viewstate MAC failed

i have some nodes added to my treeview inside of an updatepanel and it seems to give me "

Validation of viewstate MAC failed" error each tme i click a node twice.

Nothing happens on the first time i click a node

is there some tutorial or standard thing to do with a treeview in an update panel?

It sounds very strange about asp:TreeView and asp:UpdatePanel from your description.Can you post some codes here? I'd like to test it.
I tested asp:UpdatePanel working with asp:TreeView in Ajax RC 1.0 and found it worked.
Here are my testing codes for your reference.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TreeView ID="tv" runat="server" OnSelectedNodeChanged="tv_SelectedNodeChanged">
<Nodes>
<asp:TreeNode Text="File" Value="File"></asp:TreeNode>
<asp:TreeNode Text="Edit" Value="Edit"></asp:TreeNode>
<asp:TreeNode Text="View" Value="View"></asp:TreeNode>
</Nodes>
</asp:TreeView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress2" runat="server"
AssociatedUpdatePanelID="UpdatePanel1"
DisplayAfter="2000"
DynamicLayout="False">
<ProgressTemplate>
UpdatePanel1 is updating now!
<input type="button" id="AbortCallbackButton" value="Abort" onclick="AbortCallback()" />
</ProgressTemplate>
</asp:UpdateProgress>
<br />
This is text after the UpdatePanel and UpdateProgress controls.
<script type="text/javascript">
function AbortCallback()
{
Sys.WebForms.PageRequestManager.getInstance().abortPostBack();
}
</script>
Behind Codes:
protected void tv_SelectedNodeChanged(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(10000);
}
Wish this can help you.

No comments:

Post a Comment