web user control in RadPanelBar not being created

9 posts, 0 answers
  1. Mark Bennett
    Mark Bennett avatar
    5 posts
    Member since:
    Jan 2010

    Posted 19 Jan 2010 Link to this post

    Hi,

    At the moment im swapping over an Ajax accordion to a RadPanel bar, however it doesnt create the user control when its inside the panelbar, but when its outside of it, it works fine, the user control is not ajax.

    my code looks like this


        <telerik:RadPanelBar  
        ID="radAccordionSheepSales"  
        runat="server"  
        ExpandMode="SingleExpandedItem"
            <Items> 
                <telerik:RadPanelItem runat="server" Text="Sheep Sales"
                <ItemTemplate> 
                    <table class="SheepSales_Table"
                        <tr> 
                            <td>                 
                                <uc1:ucSheepSales ID="ucSheepSales1" runat="server" />                 
                            </td> 
                            <td> 
                                <asp:LinkButton ID="btnAdd" runat="server" SkinID="SheepSales_BtnAdd">Add</asp:LinkButton> 
                            </td>     
                        </tr> 
                        <tr> 
                            <td> 
                                <div id="scrollDiv" class="SheepSales_Placeholder"
                                    <asp:UpdatePanel ID="SheepSales_UpdateContainer" runat="server"
                                        <ContentTemplate> 
                                            <asp:PlaceHolder ID="phSheepSales" runat="server"></asp:PlaceHolder> 
                                        </ContentTemplate> 
                                    </asp:UpdatePanel> 
                                </div> 
                            </td> 
                            <td> 
                            </td>     
                        </tr> 
                    </table>             
                </ItemTemplate> 
                </telerik:RadPanelItem> 
                 
                <telerik:RadPanelItem runat="server" Text="Sheep Kills"
                <ItemTemplate> 
                        <asp:PlaceHolder ID="phKills" runat="server"
                        <uc2:ucSheep ID="ucSheep1" runat="server" DisplayMode="Header" /> 
                        </asp:PlaceHolder>             
                </ItemTemplate> 
                </telerik:RadPanelItem> 
            </Items> 
        </telerik:RadPanelBar>   

  2. Yana
    Admin
    Yana avatar
    4813 posts

    Posted 22 Jan 2010 Link to this post

    Hello Mark,

    Could you please add the user controls to the first level items (not root items) like this:

    <telerik:RadPanelItem runat="server" Text="Sheep Sales">
        <Items>
            <telerik:RadPanelItem Text="">
                <ItemTemplate>
                    <table class="SheepSales_Table">
                        <tr>
                            <td>
                               <uc1:ucSheepSales ID="ucSheepSales1" runat="server" />
                            </td>
                            <td>
                                <asp:LinkButton ID="btnAdd" runat="server" SkinID="SheepSales_BtnAdd">Add</asp:LinkButton>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div id="scrollDiv" class="SheepSales_Placeholder">
                                    <asp:UpdatePanel ID="SheepSales_UpdateContainer" runat="server">
                                        <ContentTemplate>
                                            <asp:PlaceHolder ID="phSheepSales" runat="server"></asp:PlaceHolder>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </div>
                            </td>
                            <td>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </telerik:RadPanelItem>
        </Items>
    </telerik:RadPanelItem>

    and let us know how it goes.

    Kind regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Mark Bennett
    Mark Bennett avatar
    5 posts
    Member since:
    Jan 2010

    Posted 24 Jan 2010 Link to this post

    Hey Yana,

    sorry the solution didnt work, the objects in the designer (when they are inside the radpanelbar) are failing to be initialised when the page is accessed, and so when i try to access them in the code behind(vb) file, they are null references :(
  4. Mark Bennett
    Mark Bennett avatar
    5 posts
    Member since:
    Jan 2010

    Posted 24 Jan 2010 Link to this post

    actually, ive noticed that when i use your solution, i cant even access them in the code behind file, as if their runat="server" property was not there(but it is)
  5. Yana
    Admin
    Yana avatar
    4813 posts

    Posted 28 Jan 2010 Link to this post

    Hi Mark Bennett,

    I'm sorry for the delayed reply.

    I've attached a simple page demonstrating that user control is working inside RadPanelBar template, please download the file and give it a try.

    Kind regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Mark Bennett
    Mark Bennett avatar
    5 posts
    Member since:
    Jan 2010

    Posted 28 Jan 2010 Link to this post

    Hi Yana,

    i tried your code in the project (exactly the same) and i still cant access the usercontrol in the code behind file :( i can see the panelbar and the sheepsales panelbaritem in the designer but no user control or any place holders or content
  7. Yana
    Admin
    Yana avatar
    4813 posts

    Posted 01 Feb 2010 Link to this post

    Hello Mark,

    This is really strange, which version of the controls you are using?

    Kind regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Mark Bennett
    Mark Bennett avatar
    5 posts
    Member since:
    Jan 2010

    Posted 02 Feb 2010 Link to this post

    Hey Yana,

    i am using telerik ajax asp.net 2009 Q3

    Thanks for this help really appreciate it :)

    Mark
  9. Yana
    Admin
    Yana avatar
    4813 posts

    Posted 05 Feb 2010 Link to this post

    Hello Mark Bennett,

    Try this code in my sample to access ucSheepSales1 control:

    UserControl ctrl = (UserControl)RadPanelBar1.FindItemByText("Sheep Sales").Items[0].FindControl("ucSheepSales1");


    All the best,
    Yana
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top