Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

TabStrip / Declarative DataSources

Configurator
Select a declarative datasource:

  • RadTabStrip supports binding to various types of data sources, including declarative datasources.

    Some of the declarative data sources are inherently hierarchical. These include SiteMapDataSource and XmlDataSource. When data-bound to these types of data sources, RadTabStrip automatically creates the tab hierarchy. There is no need to use the DataFieldID and DataFieldParentID properties.

    The AccessDataSource is a table-based DataSource component. It can be used to bind the tabstrip declaratively at design time. As with binding to a DataSet, DataTable, or DataView, you can use the ID-ParentID relation to establish a hierarchy among the tabs.

    RadTabStrip supports binding to an ObjectDataSource as well. In addition to the standard Tab properties (Text, Value, Navigate Url, etc.) that can be bound to the underlying business objects, the DataFieldID and DataFieldParentID properties can be specified, too. In this way, RadTabStrip can create a hierarchy of Tabs.

    Still, the business objects should provide the data needed for the RadTabStrip to build the hierarchy. If the ParentID property of the business objects are of nullable or reference type, then null values denote root Tabs. In case, the ParentID property is of value type (Integer, Guid, etc.), '0'/'Guid.Empty' values denote the root Tabs.

    For more details on the aforementioned algorithm, please read the documentation topic - Binding to object-based data sources.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.TabStrip.PopulatingWithData.DeclarativeDataSources.DefaultCS"
        Language="c#" %>

    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <qsf:HeadTag runat="server" ID="Headtag1"></qsf:HeadTag>
        <style type="text/css">
         .qsfConfigListHoriz input
         {
             margin-left: 10px;
         }
        </style>
    </head>
    <body class="BODY">
        <form runat="server" id="mainForm" method="post">
            <telerik:RadScriptManager ID="ScriptManager" runat="server" />
            <qsf:Header runat="server" ID="Header1" NavigationLanguage="C#"></qsf:Header>
            <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Configurator" Expanded="true">
             Select a declarative datasource:
    <asp:RadioButtonList AutoPostBack="true" ID="RadioButtonList1" CssClass="qsfConfigListHoriz" RepeatDirection="Horizontal"
    RepeatLayout="Flow" runat="server" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">

                 <asp:ListItem Value="XmlDataSource1" Selected="True">XmlDataSource</asp:ListItem>
                 <asp:ListItem Value="SiteMapDataSource1">SiteMapDataSource</asp:ListItem>
                 <asp:ListItem Value="ObjectDataSource1">ObjectDataSource</asp:ListItem>
             </asp:RadioButtonList>
            </qsf:ConfiguratorPanel>
            <telerik:RadTabStrip runat="server" DataTextField="Text" ID="RadTabStrip1"
                DataSourceID="XmlDataSource1" SelectedIndex="0">
            </telerik:RadTabStrip>
            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />
            <asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="TabStrip.xml" XPath="//TabCollection/Tab">
            </asp:XmlDataSource>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetSiteData" TypeName="Telerik.Web.Examples.SiteDataItem"></asp:ObjectDataSource>
            <div style="clear:both;"></div>
            <qsf:Footer runat="server" ID="Footer1"></qsf:Footer>
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451