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

How to integrate asp:Repeater with RadPanelBar

4 Answers 158 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 04 Jul 2016, 09:18 AM

Hi. I would like to know how do i integrate asp:Repeater with telerik:RadPanelBar. my final outcome would be each row in the repeater is able to show and hide as the content of the repeater might cause the whole page to be very long

i receive the following error

Telerik.Web.UI.RadPanelItemCollection must have items of type 'Telerik.Web.UI.RadPanelItem'. 'ItemTemplate' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

my markup.

01.<asp:UpdatePanel ID="UpdatePanel2" runat="server">
02.    <ContentTemplate>
03.
04.         <asp:Repeater ID="Repeater2" runat="server">
05.
06.              <HeaderTemplate>
07.                  <telerik:RadPanelBar RenderMode="Lightweight" runat="server" ID="RadPanelBar1" Width="750" Height="250"
08.                                        Skin="Telerik" ExpandMode="FullExpandedItem">
09.                                        <Items>
10.               </HeaderTemplate>
11.               <ItemTemplate>
12.                  <telerik:RadPanelItem Expanded="true" CssClass="top-offers">
13.                      <ContentTemplate>
14.                           <tr>
15.                              <td>
16.                                <asp:Label runat="server" ID="lblEntry">Entry Type <%# Container.ItemIndex+1 %></asp:Label>
17.                              </td>
18.                           </tr>
19.                           <tr>
20.                             <td>Entry Qualification</td>
21.                             <td>
22.                               <telerik:RadEditor ID="txtQualification" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "qualification") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
23.                                                        <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
24.                                                    </telerik:RadEditor>
25.                              </td>
26.                           </tr>
27.                           <tr>
28.                              <td>Academic Requirement</td>
29.                               <td>
30.                                  <telerik:RadEditor ID="txtRequirement" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "requirement") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
31.                                                        <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
32.                                                    </telerik:RadEditor>
33.                               </td>
34.                             </tr>
35.                            <tr>
36.                              <td>Relavant Working Experience</td>
37.                              <td>
38.                                 <telerik:RadEditor ID="txtExperience" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "experience") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
39.      <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
40.                                                    </telerik:RadEditor>
41.                              </td>
42.                          </tr>
43.                          <tr>
44.                            <td>
45.                              <asp:Button ID="btnRemoveCert" runat="server" Text="Remove Certificate"
46.                                                        CommandName="remove" CommandArgument='<%# Container.ItemIndex %>' />
47.                            </td>
48.                          </tr>
49.                          <tr>
50.                             <td colspan="2"><hr /></td>
51.                         </tr>
52.                 </ContentTemplate>
53.            </telerik:RadPanelItem>
54.         </ItemTemplate>
55.         <FooterTemplate>
56.                  <tr>
57.                    <td>
58.                      <asp:Button ID="btnAddEntry" runat="server" Text="Add Entry" OnClick="btnAddEntry_Click" />
59.                     </td>
60.                  </tr>
61.                  </Items>
62.              </telerik:RadPanelBar>
63.        </FooterTemplate>
64.     </asp:Repeater>
65.
66.  </ContentTemplate>
67.</asp:UpdatePanel>

4 Answers, 1 is accepted

Sort by
0
Benjamin
Top achievements
Rank 1
answered on 05 Jul 2016, 03:23 AM
to add on to my post above. each item in the asp:Repeater consist of labels and RadEditors. 
0
Accepted
Veselin Tsvetanov
Telerik team
answered on 07 Jul 2016, 07:12 AM
Hello Benjamin,

You won't be able to achieve the desired appearance in the way you are trying to do that because a server element (in this case a RadPanelBar) should be placed entirely within one template. In your implementation you open the RadPanelBar declaration within the HeaderTemplate, declare its items within the ItemTemplate and close the element within the FooterTemplate of the Repeater.

What you could do instead is to leave out the Repeater and bind the RadPanelBar to a DataSource. It will automatically generate its items and the hierarchy. Note that the RadPanelBar does not have HeaderTemplate nor FooterTemplate, so you will have to add the content of those elements separately on the page.

Regards,
Veselin Tsvetanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Benjamin
Top achievements
Rank 1
answered on 07 Jul 2016, 07:44 AM

Hi Veselin,

Thanks for reply.

i would like to check whether RadPanelBar is able to dynamically add/remove like asp:Repeater?

 

0
Accepted
Veselin Tsvetanov
Telerik team
answered on 11 Jul 2016, 02:02 PM
Hello Benjamin,

You could easily add or remove items from the RadPanelBar by using its extensive server side API. You could consult the following demo for further information on how to implement that.

Regards,
Veselin Tsvetanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
PanelBar
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Benjamin
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or