Reputation: 12441
Does anyone know how to show a asp:TreeView always expanded to the leaves? So if I have a 2-level tree, I want it to be expanded at all times. Is there a property on TreeView that does this or could you show the code snippet on how to do this?
Thank you very much! Ray.
Upvotes: 1
Views: 7671
Reputation: 1
And you can use an Integer if you only want to show the roots item per defualt:
protected void Page_Load(object sender, EventArgs e)
{
TreeView1.ExpandDepth = 1;
}
Upvotes: 0
Reputation: 5745
aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
TreeView1.ExpandAll();
}
if you also want to disable expand-collapse symbols in the tree:
<asp:TreeView ID="TreeView1" runat="server" ShowExpandCollapse="false">
</asp:TreeView>
Upvotes: 2