Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Panelbar > Programmatically Add Panels/Items/ItemTemplate
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Programmatically Add Panels/Items/ItemTemplate

Feed from this thread
  • rg avatar

    Posted on Dec 30, 2010 (permalink)

    I want to do something very similar to the following example (except programmatically):
    http://demos.telerik.com/aspnet-ajax/panelbar/examples/applicationscenarios/accessingnestedcontrols/defaultcs.aspx

    I want to have a  literal control in each panel that will display text, and 2 buttons. I have not been about to programmatically do this.

    Here is a sample of what I want. Below I have 2 panels with Text of  "Important Message" and  "Message 2". 
    How can I programattically accomplish this?

    <telerik:RadPanelBar runat="server" ID="MessagesPanel" ExpandMode="FullExpandedItem">
        <Items>
            <telerik:RadPanelItem Text="Important Message" Value="templateItem">
                <Items>
                    <telerik:RadPanelItem>
                        <ItemTemplate>
                            <div>
                                <asp:Button runat="server" ID="PrintButton" Text="Print" />
                                <asp:Button runat="server" ID="ReplyButton" Text="Reply" />
                            </div>
                            <br />
                            <div>
                                <asp:Literal runat="server" ID="Literal1" Text='message here'></asp:Literal>
                            </div>
                        </ItemTemplate>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelItem>
            <telerik:RadPanelItem Text="Message 2" Value="templateItem">
                <Items>
                    <telerik:RadPanelItem>
                        <ItemTemplate>
                            <div>
                                <asp:Button runat="server" ID="PrintButton" Text="Print" />
                                <asp:Button runat="server" ID="ReplyButton" Text="Reply" />
                            </div>
                            <br />
                            <div>
                                <asp:Literal runat="server" ID="Literal1" Text='message here'></asp:Literal>
                            </div>
                        </ItemTemplate>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelItem>
        </Items>
    </telerik:RadPanelBar>

    Thank you.

  • Posted on Dec 31, 2010 (permalink)

    Hello,

    You can add templates to RadPanelBar at runtime, using the ItemTemplate or ContentTemplate properties. Here is teh docuemanatation refering to the same.
    Adding Templates at run-time


    -Shinu.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Panelbar > Programmatically Add Panels/Items/ItemTemplate