This is a migrated thread and some comments may be shown as answers.

[Solved] PaneBar does not expand or collapse

1 Answer 121 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
AR
Top achievements
Rank 1
AR asked on 04 Aug 2009, 03:56 PM
Hi,

I have a simple panel bar with itemtemplates, within the itemtemplate i have a table containing server controls. how would i access the server controls from the server side code? Findcontrol does not seems to work.

<asp:Panel ID="pnlStudentDetails" runat="server" Height="100%" Width="100%">
   
       <telerik:RadPanelBar ID="radPnl" runat="server" Width ="70%" Skin="Sunset" 
       ExpandMode="MultipleExpandedItems">
          
       <Items>
       <telerik:RadPanelItem Text="Name" Expanded ="true" Font-Bold="True" runat="server">
           <Items>
            <telerik:RadPanelItem  runat ="server">
            <ItemTemplate>
               <asp:Table ID="tblName" runat="server">
                   <asp:TableRow id="trRow1" runat ="server" Width ="10%">
                         <asp:TableCell rowspan="3" id="tcImage" runat ="server" CssClass="TableCell" ><asp:Image ID="imgStu" runat ="server"  ImageUrl ="~/Images/logo.gif"  BorderWidth ="1px"/></asp:TableCell>
                         <asp:TableCell id="tcFullName" ColumnSpan ="3" runat ="server" CssClass="TableCell"><asp:Label ID="lblFullName" runat ="server" Text ="FullName" CssClass="labelValueSrc"></asp:Label><asp:ImageButton ID="ImgAudio" runat ="server" ImageAlign="Right"/></asp:TableCell>
                       
                   </asp:TableRow>
                   <asp:TableRow id ="trRow2" runat ="server" CssClass="TableCell">
                        <asp:TableCell id ="tcPrfName" runat ="server" CssClass="TableCell"><asp:Label ID="lblPrfName" runat ="server" Text="Preferred Name" CssClass="labelSrc"></asp:Label></asp:TableCell>
                        <asp:TableCell id="tcPrfNameValue" runat ="server" CssClass="TableCell"><asp:Label ID="lblPrfNameValue" runat="server" CssClass="labelValueSrc"></asp:Label></asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow id="trRow3" runat="server" CssClass="TableCell">
                        <asp:TableCell id="tcNotes" runat ="server" CssClass="TableCell"><asp:Label ID="lblNotes" runat="server" Text ="Notes/Messages" CssClass="labelSrc"></asp:Label></asp:TableCell>
                        <asp:TableCell id="tcNotesValue" runat="server" CssClass="TableCell"><asp:Label ID ="lblNotesValue" runat ="server"  CssClass="labelValueSrc"></asp:Label></asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
            </ItemTemplate>
            </telerik:RadPanelItem>
            </Items>
       </telerik:RadPanelItem>
</telerik:RadPanelItem>
</asp:Panel>

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 06 Aug 2009, 02:04 PM
Hello AR,

First, you need to find the child item with the template. I set the value property so I can easily access the item: <telerik:RadPanelItem Value="childItemTemplate" runat="server">
Then, in page load I access a random control fromt the template:

 protected void Page_Load(object sender, EventArgs e)  
    {  
        RadPanelItem child1 = radPnl.FindItemByValue("childItemTemplate"as RadPanelItem;  
        Label lbl1 = child1.FindControl("lblPrfName"as Label;  
        lbl1.Text = "Text has been customized";  
    } 



Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
AR
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or