RadTabStrip fully supports binding to a wide range of datasources:
- DataSet, DataTable, DataView
- ASP.NET DataSource types including
- Hierarchical DataSource components, such as SiteMapDataSource
- Table-based DataSource components, such as SqlDataSource, LinqDataSource, EntityDataSouce, ObjectDataSource
- Any object that implements the IEnumerable interface
Below are the properties and methods related to data binding:
DataSource - Set to an instance of your data source. This is mandatory when
binding the RadTabStrip at runtime.
DataSourceID - Set to the ID of your data source. This is
mandatory when binding the RadTabStrip declaratively.
DataMember - If the data source is a DataSet and DataMember is set, then
the RadTabStrip is bound to the DataTable with the respective name in the DataSet.
If DataMember is not set, the RadTabStrip is bound to the first DataTable in the
DataFieldID - This is the field name from the data source used to uniquely
identify each row. This field is required when binding to hierarchical data.
DataFieldParentID - This is the field name from the data source used to identify
the row for the parent tab. This field is required when binding to hierarchical
DataTextField - This is the field name from the data source that populates
each tab's Text property during binding.
DataValueField - This is the field name from the data source that populates
each tab's Value property during binding.
DataNavigateUrlField - This is the field name from the data source that populates
each tab's NavigateUrlField property during binding.
DataBind - Call this method after you have set the aforementioned properties
when binding at runtime. This method is mandatory for binding at runtime.
MaxDataBindDepth - This property is used to determine the binding depth.
If for example you want to bind only the first two levels of the
tabstrip, you should set this property to 2. The default value
of the MaxDataBindDepth property is -1, which
means that all tabs will be bound. Marking the tabstrip instance with MaxDataBindDepth="0"
will NOT bind any tabs.
AppendDataBoundItems - If you bind the tabstrip using the DataBind method,
all tabs are automatically cleared. Setting AppendDataBoundItems to True
preserves the tabs that are already present in the tabstrip. This lets you bind
RadTabStrip to multiple data sources or use both unbound and bound modes.
If the data source contains fields that map to other properties of tabs or to custom
attributes, use the TabDataBound event to set those values:
protected void RadTabStrip1.TabDataBound(object sender,
e.Tab.ToolTip ="Read more about " +
(string) DataBinder.Eval(e.Tab.DataItem, "Text");
Protected Sub RadTabStrip1_TabDataBound(ByVal sender As Object, _
ByVal e As Telerik.Web.UI.RadTabStripEventArgs) Handles RadTabStrip1.TabDataBound
e.Tab.ToolTip = "Read more about " + _
The DataBindings collection lets you provide different sets of data bindings to the tabs
on different levels of the tabstrip.
You can even bind the tabs on each level of the tabstrip
from different tables in a DataSet.
This example demonstrates how to use databindings to apply
declarative mapping of data fields to the tab properties.