New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Basic grouping

Employees group
Contact Photo

Elizabeth Brown

Contact Photo

Diego Roel

Contact Photo

Maria Larsson

Contact Photo

Carine Schmitt

Employees group
Contact Photo

Paolo Accorti

Contact Photo

Eduardo Saavedra

Contact Photo

José Pedro Freyre

No Employee to display

This demo illustrates how you can achieve ListView-like grouping of items with RadListView. To display data in groups RadListView has the listed properties set:

  • GroupItemCount
  • GroupPlaceHolderID
  • ItemPlaceHolderID

And the following templates defined:

  • LayoutTemplate
  • GroupTemplate
  • GroupSeparatorTemplate
  • EmptyItemTemplate

The GroupItemCount property is set to the number of items displayed in each group. The GroupPlaceHolderID is the ID of the control which is used to hold all groups of the RadListView control. And the ItemPlaceHolderID is the ID of the control holding each RadListView item.

The LayoutTemplate defines how the groups should be displayed in the RadListView and the GroupTemplate defines the group structure and look. Additionally, you can declare the GroupSeparatorTemplate which is to be shown between the RadListView groups. The EmptyItemTemplate defines the layout for the non-existing items of a group. It is displayed in case the group has less items than the GroupItemCount in the empty places left.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Language="c#" Inherits="Telerik.ListViewExamplesCSharp.Grouping.BasicGrouping.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecoratedControls="Fieldset" />
    <div class="demo-container">
        <telerik:RadListView ID="RadListView1" DataSourceID="SqlDataSource1" runat="server" RenderMode="Lightweight" 
            ItemPlaceholderID="EmployeesContainer" GroupPlaceholderID="GroupsEmployeesContainer"
                <asp:PlaceHolder ID="GroupsEmployeesContainer" runat="server"></asp:PlaceHolder>
                <fieldset class="groupFieldset">
                    <legend>Employees group</legend>
                                <asp:PlaceHolder ID="EmployeesContainer" runat="server"></asp:PlaceHolder>
                    <div class="employeeEmptyTemplateWrapper">
                        <img src="images/EmtpyItemImage.jpg" width="120px" height="150px" alt="No Employee to display" class="image"
                            title="No Employee to display"/>
                <div class="employeeitemTemplateWrapper">
                    <table cellpadding="0" cellspacing="0">
                                <telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" AlternateText="Contact Photo" CssClass="image"
                                    ToolTip="Contact Photo" Width="120px" Height="150px" ResizeMode="Fit" DataValue='<%# Eval("Photo") == DBNull.Value? new System.Byte[0]: Eval("Photo") %>'></telerik:RadBinaryImage><br />
                                <br />
                                <span class="image"><%#Eval("ContactName")%><br /></span>
                                <br />
        <div class="clearFix">
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT top 7 * FROM [CustomerPhotos]"></asp:SqlDataSource>

Support & Learning Resources

Find Assistance