Server-side
RadNavigation supports binding to various types of data sources:
-
DataSet, DataTable, DataView
-
ASP 2.0 DataSource types including
-
Hierarchical DataSource components
-
Table-based DataSource components
-
Any object that implements the IEnumerable interface.
To bind the Navigation to a data source, specify the data source as the value of the DataSource property and call the DataBind method.If you are using declarative data sources such as AccessDataSource or SiteMapDataSource, use the DataSourceID property instead of the DataSource property.
Usually, you also want to do one or more of the following:
-
Set Text or NavigateUrl properties using:
-
DataTextField - specifies the field of the data source that provides the Text of the navigation nodes.If this field does not contain string values, you can use the DataTextFormatString property to ensure that field values are formatted the way you want.
-
DataNavigateUrlField - Specifies the field of the data source that provides the NavigateUrl of the navigation nodes.
-
If the data source is not hierarchical, you can establish the hierarchy through an ID to DataFieldParentID relationship using:
-
DataFieldParentID - The name of the field in the data source that identifies the key field value of the parent node.The value of this field for root nodes should be null(table- or object-based data source) or the default value of thecorresponding value type used (object-based data source).
protected void RadNavigation1_NodeDataBound(object sender, NavigationNodeEventArguments e)
{
e.Node.ToolTip = "Read more about " + (string)DataBinder.Eval(e.Node.DataItem, "Text");
if (e.Node.Text == "Home")
{
e.Node.Selected = true;
}
}