Tree visual control is the most effective control in ASP.NET 2.0. This tree is used to display hierarchical data in visual format. This page also supports the dynamic population of the node on demand without refresh.
When TreeView is displayed for the first time, it displays all its nodes. However, this extension can be controlled by setting up the Deepthroat property.
Properties like backcolor, foreclosure, borderroller, border style, borderwidth, height etc are applied through the style of tables, trades, TD /> tags.
Following are some important properties that are very useful.
Properties of TreeView Control | |
---|---|
DataSourceID | Indicates the data source to be used (You can use .sitemap file as datasource). |
Text | Indicates the text to display in the node. |
Tooltip | Indicates the tooltip of the node when you mouse over. |
Value | Indicates the nondisplayed value (usually unique id to use in server side events) |
NavigateUrl | Indicates the target location to send the user to the node when the click is clicked. If not set, you can control the tree view. |
Target | If NavigationTool property is set, this indicates how to open the target location (in a new window or in the same window) |
ImageUrl | Indicates the image that appears next to the node. |
ImageToolTip | Indicates the tooltip text to display for image next to the node. |
Styles of TreeView Control | |
NodeSpacing | Space (in pixel) between current node and the node above or below it. |
VerticalPadding | Space (in pixel) between the top and bottom of the node text. |
HorizontalPadding | Space (in pixel) between the left and right of the node text. |
ChildNodePadding | Space (in pixel) between the parent node and its child node. |
Home
About
- Company
- Terms
- Vision
Example -
// TreeView Control ////////////////////////////
<asp:TreeView ID="TreeView1" runat="Server" DataSourceID="SiteMapDataSource1" ImageSet="Simple"
ExpandDepth="1">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
<SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px"
VerticalPadding="0px" />
<NodeStyle Font-Names="Tahoma" Font-Size="10pt" ForeColor="Black" HorizontalPadding="0px"
NodeSpacing="0px" VerticalPadding="0px" />
</asp:TreeView>
// SiteMapDataSource Control ////////////////////////////
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="Server" />
0 comments:
Post a Comment