weird error when set treeview control EnableViewState is true

H

haiwen

Hello, everyone:

I am using Microsoft treeview control, I dynamically load all of nodes in
Page_load,

if I set the EnableViewState is true (default setting), when I click another
server control, even do nothing and just postback, I always get follow error
no matter I load the nodes all the time ( not just in !IsPostBack) in
Page_Load.

if I set the EnableViewState is false, it works fine when I load the nodes
all the time in Page_load.

I prefer, just like other web controls, that load the nodes one time
(!ispostback) and set EnableViewState is true.

could anyone help me out? Thanks a lot.

haiwen

[ArgumentOutOfRangeException: Specified argument was out of the range of
valid values.
Parameter name: Index was out of range. Must be non-negative and less than
the size of the collection.]
System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32
index) +199

Microsoft.Web.UI.WebControls.BaseChildNodeCollection.System.Web.UI.IStateManager.LoadViewState(Object state)
Microsoft.Web.UI.WebControls.TreeView.LoadViewState(Object savedState)
System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain() +423
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top