TreeView nodes always have .Checked=true on postback even when not checked in UI
Posted
by GISmatters
on Stack Overflow
See other posts from Stack Overflow
or by GISmatters
Published on 2010-03-15T01:07:52Z
Indexed on
2010/03/15
1:09 UTC
Read the original article
Hit count: 368
I have a treeview in my .aspx:
<asp:TreeView ID="tvDocCatAndType" runat="server" />
Not much else going on in the page -- two <asp:LinkButtons>
and one <asp:Label>
; the page is a child of a master page, so these controls are within a <asp:Content>
control. I populate the treeview in code -- just 3 node levels, including the root node. All nodes have checkboxes, and I initialize all node.Checked to true. I have some Javascript to do the usual check/uncheck up and down the tree as parent and child node checkboxes are toggled.
No matter how many checkboxes I clear in the UI, on postback every single node has node.Checked = true regardless of the state of the checkbox in the UI.
This is not the first time I've used a treeview, but I've never had this problem before. I created this page by light adaptation of an earlier project that works fine. Thanks in advance for any helpful comments or questions,
Chris
© Stack Overflow or respective owner