Display RadGrid items in grouping as ListView layout

2 posts, 0 answers
  1. Ali
    Ali avatar
    24 posts
    Member since:
    Apr 2010

    Posted 02 Oct 2012 Link to this post

    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]">
  2. Andrey
    Andrey avatar
    836 posts

    Posted 05 Oct 2012 Link to this post


    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.
Back to Top