Overview
Data Binding is achieved by setting the DataSource property and calling the DataBind() method. If you are using declarative data sources such as AccessDataSource or SiteMapDataSource, databinding is achieved by specifying the DataSourceID.
 |
You can get a working demo application on Data Binding from our code library here. |
Usually, you would also want to do one or some of the following:
- Set Text, Value or NavigateUrl properties using:
- DataTextField - Gets or sets the field of the data source that provides the Text of the tabstrip items.
- DataNavigateUrlField - Gets or sets the field of the data source that provides the NavigateUrl of the tabstrip items.
-
DataValueField - Gets or sets the field of the data source that provides the
Value of the tabstrip items
- Set other properties
Properties other than the above three (Text, Value and NavigateUrl) can be set in the TabDataBound event:
| C# |
Copy Code |
|
protected void RadTabStrip1_TabDataBound(object sender, TabStripEventArgs e) { e.Tab.ToolTip ="Read more about " + (string)DataBinder.Eval(e.Tab.DataItem, "Text"); } |
| VB.NET |
Copy Code |
|
Protected Sub RadTabStrip1_TabDataBound(ByVal sender As Object, ByVal e As TabStripEventArgs) e.Tab.ToolTip = "Read more about " + CStr(DataBinder.Eval(e.Tab.DataItem, "Text")) End Sub |
- Establish hierarchy through ID to ParentID relationship using:
- DataFieldID - The name of the DataColumn holding the ID value.
- DataFieldParentID - The name of the DataColumn holding the ParentID value. The id of the root items should be null.
With respect to binding to Telerik RadTabStrip, data sources can be divided into two major categories:
1. Data Sources from which Telerik RadTabStrip can create tabstrip item hierarchy
 |
When the tabstrip is bound to such data sources it can have not only root items, but also child items:
root tab 1 root tab 2
child tab 2.1 child tab 2.2 |
-
Data Sources from which Telerik RadTabStrip will automatically create tabstrip item hierarchy:
-
XmlDataSource
-
SiteMapDataSource
- Data Sources which require the ID to ParentID relationship to establish hierarchy:
 |
The ID to ParentID relationship is established by setting the DataFieldID and DataFieldParentID properties |
2. Data Sources from which Telerik RadTabStrip cannot create tabstrip item hierarchy
 |
When the tabstrip is bound to such Data Sources it is flat, i.g. it has only root items
root tab 1 root tab 2 root tab 3
Setting DataFieldID and DataFieldParentID will have no effect. |
See Also