使TreeView节点默认不展开
Making TreeView Nodes Not Expanded by Default
大家好,
我有一个用作导航的 Treeview。默认情况下,当页面加载时,带有子节点的节点会展开。
我希望默认情况下隐藏此子节点,并且只应在单击时展开。
下面是我的 TreeView 目前的代码:
<asp:TreeView ID="TV_Navigation" runat="server" ImageSet="Simple" NodeIndent="10"
DataSourceID="SiteMapDataSource1">
<HoverNodeStyle Font-Underline="True" ForeColor="#DD5555" />
<NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="0px"
NodeSpacing="2px" VerticalPadding="0px"></NodeStyle>
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" VerticalPadding="0px"
ForeColor="#DD5555" />
</asp:TreeView>
您可能需要将控件的 ExpandDepth
属性 设置为 0。-1 是显示所有节点的默认值。
Gets or sets the number of levels that are expanded when a TreeView
control is displayed for the first time.
大家好,
我有一个用作导航的 Treeview。默认情况下,当页面加载时,带有子节点的节点会展开。 我希望默认情况下隐藏此子节点,并且只应在单击时展开。
下面是我的 TreeView 目前的代码:
<asp:TreeView ID="TV_Navigation" runat="server" ImageSet="Simple" NodeIndent="10"
DataSourceID="SiteMapDataSource1">
<HoverNodeStyle Font-Underline="True" ForeColor="#DD5555" />
<NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="0px"
NodeSpacing="2px" VerticalPadding="0px"></NodeStyle>
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" VerticalPadding="0px"
ForeColor="#DD5555" />
</asp:TreeView>
您可能需要将控件的 ExpandDepth
属性 设置为 0。-1 是显示所有节点的默认值。
Gets or sets the number of levels that are expanded when a TreeView control is displayed for the first time.