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

PanelBar / Templates

    • Understanding Exposure
      Understanding Exposure:
      How to Shoot Great Photographs
    • The Ultimage Guide
      Get the Most from Your
      Digital Camera: The Ultimage Guide
    • Digital SLR Cameras
      Digital SLR Cameras:
      Photography for Dummies
    • Cannon PowerShot SD1000
      Cannon PowerShot SD1000
    • Cannon PowerShot A570IS
      Cannon PowerShot A570IS
    • VTech Kidizoom
      VTech Kidizoom
    • Airform Digital Camera Case
      Airform Digital Camera Case
    • Case Logic Large
      Case Logic Large
    • Lewis N. Clark Waterproof Case
      Lewis N. Clark Waterproof Case
  • Customer testmonials
    Testimonials
  • How to find us
    How to find us

  • General

    You can embed any content inside RadPanelBar's ContentTemplate and HeaderTemplate:
    • HTML markup
    • ASP.NET server controls
    • Third-party controls (other Telerik controls as well)
            <telerik:RadPanelItem Expanded="true">
                <HeaderTemplate>
                    <telerik:RadMenu ID="RadMenu1" runat="server">
                        ...
                    </telerik:RadMenu>
                </HeaderTemplate>
                <ContentTemplate>
                    <telerik:RadMultiPage runat="server" ID="RadMultiPage1">
                        ...
                    </telerik:RadMultiPage>
                </ContentTemplate>
            </telerik:RadPanelItem>
    
    All server controls located in the templates are directly accessible by their IDs on Page-level. Instead of using the common syntax
            RadPanelBar1.Items[0].Header.FindControl("RadMenu1") //inside a HeaderTemplate
            RadPanelBar1.Items[0].FindControl("RadMultiPage1") //inside a ContentTemplate
        
    you can use RadMenu1 or RadMultiPage1 to reference the control located inside the respective template of the first root Item of a PanelBar.

    HeaderTemplate

    The content in the HeaderTemplate replaces the default content of the PanelItem header. Clicking anywhere on the header will still collapse/expand the Item unless the click event bubbling is manually stopped.

    If you want to stop the propagation of the click event you can wrap the target content with a <div> element and handle its click event in this way:
            function stopPropagation(e) {
                e.cancelBubble = true;
    
                if (e.stopPropagation)
                    e.stopPropagation();
            }
        

    Note: In this demo we manually expand/collapse the Item when clicking on the RadMenu because it already does the mentioned above.

    ContentTemplate

    The purpose of the ContentTemplate is to provide an Item with an animated expandable/collapsible container, which holds rich HTML content instead of a standard child Item structure, e.g. The ContentTemplate is defined per Item and is available on every level. An Item can have either a ContentTemplate or child Items.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>

    <%@ Page Language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="true" Inherits="Telerik.Web.Examples.PanelBar.Functionality.Templates.DefaultCS" %>

    <%@ 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 ID="Headtag1" runat="server" />
        <link type="text/css" rel="Stylesheet" href="styles.css" />
    </head>
    <body class="BODY">
        <form id="mainForm" method="post" runat="server">
        <telerik:RadScriptManager ID="ScriptManager" runat="server" />
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="C#" ShowSkinChooser="false" />
          <telerik:RadPanelBar runat="server" ID="RadPanelBar1" Width="742px" Height="330px"
            Skin="Forest" ExpandMode="FullExpandedItem" OnClientLoad="onLoad">
            <Items>
                <telerik:RadPanelItem>
                    <ItemTemplate>
                    </ItemTemplate>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Expanded="true">
                    <HeaderTemplate>
                        <div style="float: left; padding-top: 1px; z-index: 2800;">
                            <telerik:RadMenu ID="RadMenu1" runat="server" OnClientItemClicked="onItemClicked"
                                Skin="Forest" Style="z-index: 2900">
                                <Items>
                                    <telerik:RadMenuItem Text="Books" Selected="true">
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem Text="Cameras">
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem Text="Apparel">
                                    </telerik:RadMenuItem>
                                </Items>
                            </telerik:RadMenu>
                        </div>
                        <div style="float: right;">
                            <div onclick="stopPropagation(event)" style="position: relative; top: 4px; right: 2px;">
                                <asp:ImageButton ID="promotions" runat="server" ImageUrl="Images/special.gif" OnClientClick="showSpecialOffers();return false;" />
                            </div>
                        </div>
                    </HeaderTemplate>
                    <ContentTemplate>
                        <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0" CssClass="multiPage">
                            <telerik:RadPageView runat="server" ID="RadPageView1">
                                <ul class="productList">
                                    <li>
                                        <img src="Images/exposure.gif" alt="Understanding Exposure" />
                                        <div>
                                            Understanding Exposure:<br />
                                            How to Shoot Great Photographs</div>
                                    </li>
                                    <li>
                                        <img src="Images/digitalCamera.gif" alt="The Ultimage Guide" />
                                        <div>
                                            Get the Most from Your<br />
                                            Digital Camera: The Ultimage Guide</div>
                                    </li>
                                    <li class="last">
                                        <img src="Images/slr.gif" alt="Digital SLR Cameras" />
                                        <div>
                                            Digital SLR Cameras:<br />
                                            Photography for Dummies</div>
                                    </li>
                                </ul>
                            </telerik:RadPageView>
                            <telerik:RadPageView runat="server" ID="RadPageView2">
                                <ul class="productList">
                                    <li>
                                        <img src="Images/SD1000.gif" alt="Cannon PowerShot SD1000" />
                                        <div>
                                            Cannon PowerShot SD1000</div>
                                    </li>
                                    <li>
                                        <img src="Images/A570IS.gif" alt="Cannon PowerShot A570IS" />
                                        <div>
                                            Cannon PowerShot A570IS</div>
                                    </li>
                                    <li class="last">
                                        <img src="Images/kidizoom.gif" alt="VTech Kidizoom" />
                                        <div>
                                            VTech Kidizoom</div>
                                    </li>
                                </ul>
                            </telerik:RadPageView>
                            <telerik:RadPageView runat="server" ID="RadPageView3">
                                <ul class="productList">
                                    <li>
                                        <img src="Images/case.gif" alt="Airform Digital Camera Case" />
                                        <div>
                                            Airform Digital Camera Case</div>
                                    </li>
                                    <li>
                                        <img src="Images/largeCase.gif" alt="Case Logic Large" />
                                        <div>
                                            Case Logic Large</div>
                                    </li>
                                    <li class="last">
                                        <img src="Images/waterproof.gif" alt="Lewis N. Clark Waterproof Case" />
                                        <div>
                                            Lewis N. Clark Waterproof Case</div>
                                    </li>
                                </ul>
                            </telerik:RadPageView>
                        </telerik:RadMultiPage>
                    </ContentTemplate>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Customer testmonials" Expanded="false">
                    <ContentTemplate>
                        <img src="Images/Testimonials.gif" alt="Testimonials" style="margin: 0 auto" width="740"
                            height="157" />
                    </ContentTemplate>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="How to find us" Expanded="false">
                    <ContentTemplate>
                        <img src="Images/How-to-find-us.gif" alt="How to find us" style="margin: 0 auto"
                            width="740" height="156" />
                    </ContentTemplate>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>
        <telerik:RadWindow ID="RadWindow1" runat="server" Skin="Forest" Behaviors="Close, Move"
            Modal="true" Width="440px" Height="385px">
            <ContentTemplate>
                <img id="Img1" src="Images/discount.jpg" runat="server" alt="promotions" />
            </ContentTemplate>
        </telerik:RadWindow>
        <script type="text/javascript">

            var panelBar;
            var panelBarProductsTab;
            var multiPage;

            function onLoad(sender) {
                panelBar = sender;
                panelBarProductsTab = panelBar.get_items().getItem(1);
                multiPage = panelBar.get_items().getItem(1).findControl("RadMultiPage1");
            }

            function onItemClicked(sender, eventArgs) {
                if (!panelBarProductsTab.get_selected()) {
                    panelBarProductsTab.expand();
                    panelBarProductsTab.select();
                }

                var pageView = multiPage.get_pageViews().getPageView(
                    eventArgs.get_item().get_index());

                pageView.set_selected(true);
            }

            function showSpecialOffers() {
                var oWnd = $find("<%= RadWindow1.ClientID %>");
                oWnd.set_visibleStatusbar(false);
                oWnd.show();
            }

            function stopPropagation(e) {
                e.cancelBubble = true;

                if (e.stopPropagation)
                    e.stopPropagation();
            }
            
        </script>
        <qsf:Footer ID="Footer1" runat="server" />
        </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