APNSoft - Web Controls, components for ASP.NET Home Help Center Contact Us
About UsProductsDownloadsPurchase
Support

TreeView
Version 3.0



What's New
Overview
Features
Reference Book
Licensing
Support



Populating with Data
Layout and Behavior
Design
Programming




APNSoft TreeView uses XML for defining the structure since XML is the most convenient format for structured data. The XML TreeView Structure consists of a number of elements (items).

        <TreeView>
            <item title="Main Page" />
            <item title="About Us" />
            <item title="Products">
                <item title="Menu" />
                <item title="TreeView" />
                <item title="Include" />
            </item>
            <item title="Contacts" />
        </TreeView>


The code above creates the following TreeView:

	


You can save the XML definition structure as a file and bind the TreeView by specifying the StructureFileURL property of the TreeView component.

You can build up TreeView at runtime. APNSoft TreeView provides an extremely rich and powerful server-side API allowing developer to add, remove or edit TreeView elements and element collections. You can programmatically control any item at runtime by using two classes TreeViewElement and TreeViewElementCollection.

You can also apply the XML Document with structure by using the DataSource property. If the TreeView loads structure from the database, you should set the DataSource property to specify a source of data and call the DataBind() method.

APNSoft TreeView has support to use the Web.sitemap file as a standard TreeView structure.


Structure elements
  • TreeView - the root element for entire TreeView Structure. Attributes are not included.

  • item - one TreeView element. Each item element can include other item elements.

    Can include attributes:

    • id - is used in order to ensure uniqueness. If the id attribute is not specified, the component will automatically set it for each TreeView item (id="itm1", id="itm2", etc.) Item ids are used as the prefixes for naming all of HTML and JavaScript parts. Using short item ids will decrease the overall amount of rendered markup.
      Also the id attribute can be applied when the OnItemClick server side event is handled.
      Note. Do not use special symbols like *, &, \, etc. in attribute values.

    • title - specifies the text (caption) displayed for the TreeView item. Can use HTML formatting.

    • href, target - the URL and target the browser is directed to when a user clicks the item. Full analogue with the HTML attributes. The href attribute switches off the AutoPostBack property.
      The href attribute value can include a JavaScript call with special active blocks $TreeViewID$ and $ItemID$, instead of which data is inserted.

    • icon - specifies the name of the one item's icon image. The icon image displayed at the left side of the one TreeView item. The icon images must be located in the Skin Folder as specified by the SkinFolderURL property.

    • iconOpen - specifies the name of the icon file for the expanded node.

    • iconWidth, iconHeight - one item's icon image width and height. This attributes can be specified only once if the TreeView uses icons with identical width and height.

    • opened - keeps the current item expanded.

    • selected - keeps the current item selected.

    • Checked - keeps the current item checked.

    • AutoPostBack - one item's attribute that turning off the component property AutoPostBack only for specified TreeView item. Example:

      <TreeView>
        <item id="1" title="Home" />
        <item id="2" title="About Us" AutoPostBack="false">
      	<item id="3" title="Awards" />
      	<item id="4" title="Certificates" />
        </item>
      </TreeView>
      


    Attention! Element names and attributes are case-sensitive. Be careful when you are typing in your data.




  © 2003-2008 APNSoft. All rights reserved. Table of Contents   Terms of use   Contact Us   Help Center