PanelBar - Data Bindings

  • Politics
    • Level 1 > CNN
    • Level 1 > NBC
    • Level 1 > ABC
  • Sports
    • Level 1 > US Sports
      •  Level 2 > Baseball
      •  Level 2 > Football
      •  Level 2 > BasketBall
    • Level 1 > European Sports
      •  Level 2 > Soccer
      •  Level 2 > Volleyball
  • Events
    • Level 1 > Oscar Awards
    • Level 1 > MTV Movie Awards
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

The DataBindings collection lets you provide different sets of data bindings to the items on different levels of the panelbar. You can even bind the panel items on each level of the panelbar from different tables in a DataSet.
This example demonstrates how to use databindings to apply declarative mapping of data fields to panel item properties.

        <telerik:RadPanelBar 
            id="RadPanelBar1" 
            runat="server" 
            DataSourceID="AccessDataSource1"
            DataFieldID="id"
            DataFieldParentID="ParentId">

        <DataBindings>
             <telerik:RadPanelItemBinding TextField="Text" />
             <telerik:RadPanelItemBinding FormatString="Level 1 > {0}" TextField="Text" Depth="1" />
        </DataBindings>

        </telerik:RadPanelBar>
    
  • DefaultCS.aspx
<%@ Page Language="c#"  %>

<%@ 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">
    <title>Telerik ASP.NET Example</title>
</head>

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-thin">
        <telerik:RadPanelBar RenderMode="Lightweight" ID="RadPanelBar1" runat="server" Width="300px" Height="300" ExpandMode="FullExpandedItem"
            DataSourceID="SqlDataSource1" DataFieldID="id" DataFieldParentID="ParentId">
            <DataBindings>
                <telerik:RadPanelItemBinding Depth="0" TextField="Text" Expanded="true" />
                <telerik:RadPanelItemBinding FormatString="Level 1 &gt; {0}" TextField="Text" Depth="1" />
                <telerik:RadPanelItemBinding FormatString="&nbsp;Level 2 &gt; {0}" TextField="Text" Depth="2" />
            </DataBindings>
        </telerik:RadPanelBar>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="select id, text, parentId from Links"
        ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"></asp:SqlDataSource>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?