I have an asp.net page which has a web control.
This web control displays a Treeview, TextBox and a button.
For the treeview i do on Page_Load:
if (!Page.IsPostBack) {
BindTreeView();
}
This is my TreeView definition:
<asp:TreeView ID="TvwData" runat="server"
BackColor="White" ShowCheckBoxes="Leaf" Width="99%"
ExpandDepth="3" AutoGenerateDataBindings="false"
onselectednodechanged="TvwData_SelectedNodeChanged"
EnableViewState="true"
>
The TreeView is shown correctly.
However, when I click the submit button, the following happens:
- Page reloads, textbox still displays my text which is OK.
- My Treeview doesn’t display any data at all.
- When debugging, TvwData.CheckedNodes doesn’t contain any data while I’m sure there are treeview items checked.
I really tried my best to found a solution on major ASP.NET forums, but I’m clueless at this moment.
Thanks in advance!
Try the following:
Furthermore, remove BindTreeView(); from Page_Load.