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

Display RadGrid items in grouping as ListView layout

1 Answer 68 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Ali asked on 02 Oct 2012, 09:35 PM
I am trying to use RadGrid as ListView layout and was able to follow the demo below to achieve the results.

Grid / ListView/DataList View: 

Now, I need to be able to use "Grouping" [using ContactTitle:] so that all the items are shown under corresponding Grouping.
I know the layout may seem impossible for RadGrid, but I believe it's possible, though I haven't figured out how? Does anyone know how to do it as I need it badly [without using ListView, only RadGrid]. Please see my code below.

Thanks for your help. 

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MainGrid_Box.ascx.cs" Inherits="_Default_MainGrid_Box" %>
<telerik:RadGrid ID="RadGrid_r2bweb_Box" GridLines="None" runat="server" AllowSorting="true" AllowPaging="false" DataSourceID="SqlDataSource_r2bweb_Box">
    <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"/>
    <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="url_id"
        DataSourceID="SqlDataSource_r2bweb_Box" HorizontalAlign="NotSet" AutoGenerateColumns="true"
        GroupLoadMode="Client" GroupsDefaultExpanded="true" TableLayout="Fixed">
            <asp:CheckBox ID="CheckBox_Main_Box" runat="server" onclick="CheckAll(this);" />
            <asp:Label runat="server" ID="r2b_GroupingHeader_Main_Box" Text='<%# " lst_name(s): "+Eval("lst_name") %>'
            Visible='<%# ((((GridGroupHeaderItem)Container).AggregatesValues["lst_name"]) != null)%>'></asp:Label>
                    <telerik:GridGroupByField FieldAlias="lst_name" FieldName="lst_name"></telerik:GridGroupByField>
                    <telerik:GridGroupByField FieldName="lst_name" SortOrder="Descending"></telerik:GridGroupByField>
            <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %>
            <asp:Panel ID="r2bweb_panel" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>' HorizontalAlign="Center" runat="server">
                <asp:Image ID="r2bweb_mySites" Style="float: left; text-align:center;" Width="50px" Height="50px" ImageUrl="~/Images/mySites.png" runat="server" AlternateText="My Site" />
                <br />
                <%# Eval("url_name")%>
    <ClientSettings AllowDragToGroup="false" AllowColumnsReorder="false" AllowRowsDragDrop="True"
        <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" />
        <Resizing AllowRowResize="True" EnableRealTimeResize="false" ResizeGridOnColumnResize="false"           
        AllowColumnResize="True" AllowResizeToFit="true" ShowRowIndicatorColumn="false"
        ClipCellContentOnResize="false" />
        <Scrolling AllowScroll="false" UseStaticHeaders="True" SaveScrollPosition="true" />
<asp:SqlDataSource ID="SqlDataSource_r2bweb_Box" runat="server"
ConnectionString="<%$ ConnectionStrings:r2bweb_ConnectionString %>"
    SelectCommand="SELECT a.[lst_id], b.[lst_name], a.[url_id], a.[urp_id], a.[usr_id], a.[cat_id], a.[url_isOpen], a.[url_type], a.[url_name], a.[url_address], a.[url_isLoginOrOpen], a.[url_username], a.[url_isSaveUsername], a.[url_isEnableUsername], a.[url_password], a.[url_isSavePassword], a.[url_isEnablePassword], a.[url_desc], a.[url_isSave] FROM [t_url] a INNER JOIN [t_myList] b ON a.[lst_id] = b.[lst_id]">

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 05 Oct 2012, 03:24 PM

As my colleague Tsvetina said to you in the other thread that you have opened, that required layout could not be achieved with RadGrid,

If you want to achieve the desired layout you will need to reiimplement half the logic of RadGrid and finally you will get the implementation of RadListView.

the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question