Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As another <code>DataBound</code> controls you have to override <code>PerformDataBinding</code> method as follows.</p> <pre><code>protected override void PerformDataBinding() { base.PerformDataBinding(); if (!IsBoundUsingDataSourceID &amp;&amp; this.DataSource == null) return; HierarchicalDataSourceView view = this.GetData(string.Empty); if (view != null) { IHierarchicalEnumerable root = view.Select(); } } </code></pre> <p>Whereas your control supports <code>DataSource</code> and <code>HierarchialDataSource</code> control in this case, should check if there is an assigned <code>DataSource</code>, get its <code>DataSourceView</code> to accomplish data binding. It's practicable through <code>GetData</code> method. Then call view's <code>Select</code> method to get the root collection. </p> <p>Afterwards, you have to iterate through root collection that is an object of type <code>IHierarchialEnumerable</code>. It has a simple method called <code>GetHierarchyData</code> that gives an object which is an item of the collection and returns an associated <code>IHierarchyData</code> that describes a node. This methods is there, therefore in most times you don't know the actual type of item. <code>IHierarchyData</code> represents some information about a node and its children.</p> <p>Lastly, you don't need to write a new <code>DataSource</code> control. If you are after creating a custom navigation control, it's better to write a new provider for <code>SiteMapDataSource</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload