Grouping in RadListView Keeps Giving

2 posts, 0 answers
  1. Mansoor
    Mansoor avatar
    1 posts
    Member since:
    Feb 2014

    Posted 06 Dec 2016 Link to this post

    Hi,

    I have a site where I display a list of available Camps that the users can register for.  What I would like to do is group them by "CampStartDate".  I have the code below but no matter how I try to group, I always get the error "The RadListView control does not have an item placeholder specified."

     

    <telerik:RadListView ID="RadListView1" ItemPlaceholderID="DataGroupPlaceHolder2" DataGroups="CampStartDate" GroupPlaceholderID="DataGroupPlaceHolder1" runat="server" DataKeyNames="CampId" Skin="Bootstrap" OnSelectedIndexChanged="RadListView1_SelectedIndexChanged">
                    <LayoutTemplate>
                        <asp:Panel ID="CampHolder" runat="server">
                        </asp:Panel>
                    </LayoutTemplate>
                    <GroupTemplate>
                         <div class="vc_row wpb_row vc_inner vc_row-fluid">
                            <asp:PlaceHolder ID="CampsHolder" runat="server"></asp:PlaceHolder>
                        </div>
                    </GroupTemplate>
                    <ItemTemplate>
                            <div class="rlvI vc_col-sm-4 wpb_column vc_column_container ">
                            <asp:Label ID="CampNameLabel" CssClass="camptitle" runat="server" Text='<%# "Camp: " + Eval("CampName") %>' />
                            <br /><br />
                            <strong>Start Date:</strong> <asp:Label ID="CampStartDateLabel" runat="server" Text='<%# Eval("CampStartDate", "{0:D}") %>' />
                        </div>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                        <div class="rlvA vc_col-sm-4 wpb_column vc_column_container ">
                            <asp:Label ID="CampNameLabel" CssClass="camptitle" runat="server" Text='<%# "Camp: " + Eval("CampName") %>' />
                            <br /><br />
                            <strong>Start Date:</strong> <asp:Label ID="CampStartDateLabel" runat="server" Text='<%# Eval("CampStartDate", "{0:D}") %>' />
                        </div>
                    </AlternatingItemTemplate>
                    <EmptyDataTemplate>
                        <div class="RadListView RadListView_Bootstrap">
                            <div class="rlvEmpty">
                                There are no camps to be displayed.</div>

                        </div>
                    </EmptyDataTemplate>
                    <ValidationSettings EnableModelValidation="False" EnableValidation="False" />
                       <DataGroups>
                         <telerik:ListViewDataGroup GroupField="CampStartDate" DataGroupPlaceholderID="DataGroupPlaceHolder1"
                             SortOrder="Ascending">
                             <DataGroupTemplate>
                                 <asp:Panel runat="server" ID="Panel4" GroupingText='<%# (Container as RadListViewDataGroupItem).DataGroupKey %>'>
                                     <asp:PlaceHolder runat="server" ID="DataGroupPlaceHolder2"></asp:PlaceHolder>
                                 </asp:Panel>
                             </DataGroupTemplate>
                         </telerik:ListViewDataGroup>
                     </DataGroups>
                </telerik:RadListView>

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1961 posts

    Posted 09 Dec 2016 Link to this post

    Hi Mansoor,

    The error is thrown due to the missing placeholder in the LayoutTemplate and the GroupTemplate:
    <LayoutTemplate>
                       <asp:Panel ID="DataGroupPlaceHolder1" runat="server"></asp:Panel>

    <telerik:RadListView ID="RadListView1" ItemPlaceholderID="DataGroupPlaceHolder2" DataGroups="CampStartDate"
        GroupPlaceholderID="DataGroupPlaceHolder1" runat="server" DataKeyNames="CampId" Skin="Bootstrap" OnNeedDataSource="RadListView1_NeedDataSource">
        <LayoutTemplate>
            <asp:Panel ID="DataGroupPlaceHolder1" runat="server"></asp:Panel>
            <asp:Panel ID="CampsHolder" runat="server">
            </asp:Panel>
       </LayoutTemplate>
        <ItemTemplate>
                <div class="rlvI vc_col-sm-4 wpb_column vc_column_container ">
                <asp:Label ID="CampNameLabel" CssClass="camptitle" runat="server" Text='<%# "Camp: " + Eval("CampName") %>' />
                <br /><br />
                <strong>Start Date:</strong> <asp:Label ID="CampStartDateLabel" runat="server" Text='<%# Eval("CampStartDate", "{0:D}") %>' />
            </div>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <div class="rlvA vc_col-sm-4 wpb_column vc_column_container ">
                <asp:Label ID="CampNameLabel" CssClass="camptitle" runat="server" Text='<%# "Camp: " + Eval("CampName") %>' />
                <br /><br />
                <strong>Start Date:</strong> <asp:Label ID="CampStartDateLabel" runat="server" Text='<%# Eval("CampStartDate", "{0:D}") %>' />
            </div>
        </AlternatingItemTemplate>
        <EmptyDataTemplate>
            <div class="RadListView RadListView_Bootstrap">
                <div class="rlvEmpty">
                    There are no camps to be displayed.</div>
            </div>
        </EmptyDataTemplate>
        <ValidationSettings EnableModelValidation="False" EnableValidation="False" />
           <DataGroups>
             <telerik:ListViewDataGroup GroupField="CampStartDate" DataGroupPlaceholderID="DataGroupPlaceHolder1"
                 SortOrder="Ascending">
                 <DataGroupTemplate>
                     <asp:Panel runat="server" ID="Panel4" GroupingText='<%# (Container as RadListViewDataGroupItem).DataGroupKey %>'>
                         <asp:PlaceHolder runat="server" ID="DataGroupPlaceHolder2"></asp:PlaceHolder>
                     </asp:Panel>
                 </DataGroupTemplate>
             </telerik:ListViewDataGroup>
         </DataGroups>
    </telerik:RadListView>

    You can also refer to the following online demos for the grouping:
    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top