开发者

TreeView nodes always have .Checked=true on postback even when not checked in UI

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 popu开发者_如何学JAVAlate 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


Was poking around in the wrong place... the code to populate the treeview and the code to process the checked nodes was just fine. My error was in Page_Load, where I was unconditionally calling the populate routine, so I was always resetting the treeview to the all-checked state on postback before the code to examine the checked nodes was being executed. Duh!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜