treeview, populateondemand, updatepanel

  • Thread starter Thread starter RJN
  • Start date Start date
R

RJN

I've created a custom TreeNode extending the TreeNode class. I've added
couple of properties to the custom treenode class and have overridden
the loadviewstate and saveviewstate methods. I've created a custom
treeview control extending the TreeView control and have overridden the
CreateNode method to return custom treenode. The code works fine when I
don't use the TreeNodePopulate event of TreeView to load the nodes on
demand.

When I use the TreeNodePopulate event, and cast the e.Node from
TreeNodeEventArgs to the custom treenode, I see that custom treenode
does not contain the additional properties which I have added and they
are null. I need those properties to decide which subnodes should be
populated. The custom properties are lost here, but are available in
other events like SelectedNodeChanged event. This appears to be a bug.

Also when PopulateOnDemand is true, I see that expanding the node
doesn't load the entire page and populates only the node below. The
viewstate is also not updated which is the right behaviour. But when I
click on the node, SelectedNodeChanged event is fired and a post back
happens and the entiew viewstate is refreshed. Since I have lots of
nodes, this increases the page size heavily. I have tried placing the
TreeView inside an update panel, so that viewstate is not refreshed and
a post back does not happen, but that's not the case. Placing inside a
updatepanel is causing a postback when I click on a node.

Could someone help me pls
 
Back
Top