New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Loading Tabs from XML

You can easily load the tabs of a tab strip from an XML source, as long as the source conforms to the following structure:

  1. The top level consists of a single node, called . This node can include attributes for the RadTabStrip properties:
<?xml version="1.0" encoding="utf-16"?>
 Skin="Vista" >

  1. Immediately below the node is a set of nodes, where each node represents a root-level tab. The attributes of the node correspond to the properties and custom attributes of the tab. Any child tabs are nested within the node:
<Tab Selected="True" ScrollChildren="True" Text="Tab 1">
    <Tab PageViewID="RadPageView1" Text="Child 1" />
    <Tab IsBreak="True" PageViewID="RadPageView2" Text="Child 2" />
    <Tab PageViewID="RadPageView3" Text="Child 3" />

To discover the way to represent a specific RadTabStrip feature in XML, create a RadTabStrip with the feature and use the RadTabStrip.GetXml method to get the corresponding XML string.

Once you have an XML file of the proper format, or an XML string in the proper format, you can use it to populate a RadTabStrip object.

Loading from an XML file

Create an XML file with content that complies with the rules described above and call the LoadContentFile method to load the items, passing in the path to the file:


Loading from an XML string

Create a string with valid XML content (or fetch it from a database, for example) and use the LoadXML method to populate the tab strip from the string:

StringBuilder sb = new StringBuilder();
sb.Append(" <Tab Text='Root 1'>");
sb.Append(" <Tab Text='Child 1' />");
sb.Append(" </Tab>");
sb.Append(" <Tab Text='Root 2' />");
sb.Append(" <Tab Text='Root 3' />");
sb.Append(" </TabStrip>");
Dim sb As New StringBuilder()
sb.Append(" <Tab Text='Root 1'>")
sb.Append(" <Tab Text='Child 1' />")
sb.Append(" </Tab>")
sb.Append(" <Tab Text='Root 2' />")
sb.Append(" <Tab Text='Root 3' />")
sb.Append(" </TabStrip>")

You can also populate RadTabStrip from an XML file using an XmlDataSource component. When using XmlDataSource , the XML file does not have to follow the format shown in this topic.

See Also

In this article