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

web user control in RadPanelBar not being created

8 Answers 124 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Mark Bennett
Top achievements
Rank 1
Mark Bennett asked on 20 Jan 2010, 03:39 AM
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>   

8 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 22 Jan 2010, 02:55 PM
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.
0
Mark Bennett
Top achievements
Rank 1
answered on 24 Jan 2010, 07:16 PM
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 :(
0
Mark Bennett
Top achievements
Rank 1
answered on 24 Jan 2010, 07:22 PM
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)
0
Yana
Telerik team
answered on 28 Jan 2010, 08:20 AM
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.
0
Mark Bennett
Top achievements
Rank 1
answered on 28 Jan 2010, 07:23 PM
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
0
Yana
Telerik team
answered on 01 Feb 2010, 02:02 PM
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.
0
Mark Bennett
Top achievements
Rank 1
answered on 03 Feb 2010, 01:38 AM
Hey Yana,

i am using telerik ajax asp.net 2009 Q3

Thanks for this help really appreciate it :)

Mark
0
Yana
Telerik team
answered on 05 Feb 2010, 10:54 AM
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.
Tags
Ajax
Asked by
Mark Bennett
Top achievements
Rank 1
Answers by
Yana
Telerik team
Mark Bennett
Top achievements
Rank 1
Share this question
or