Asp.net Tree View control



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
DataSourceIDIndicates the data source to be used (You can use .sitemap file as datasource).
TextIndicates the text to display in the node.
TooltipIndicates the tooltip of the node when you mouse over.
ValueIndicates the nondisplayed value (usually unique id to use in server side events)
NavigateUrlIndicates the target location to send the user to the node when the click is clicked. If not set, you can control the tree view.
TargetIf NavigationTool property is set, this indicates how to open the target location (in a new window or in the same window)
ImageUrlIndicates the image that appears next to the node.
ImageToolTipIndicates the tooltip text to display for image next to the node.
Styles of TreeView Control
NodeSpacingSpace (in pixel) between current node and the node above or below it.
VerticalPaddingSpace (in pixel) between the top and bottom of the node text.
HorizontalPaddingSpace (in pixel) between the left and right of the node text.
ChildNodePaddingSpace (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" />

Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment