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

RadGrid - Show Group Panel

1 Answer 356 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 07 Nov 2012, 11:15 AM
Hi,
I am trying to get the show group panel to work on my page, and I sort of have, as in it does everything but sort it, it instead throws an error. I have tried looking for help on it on articles such as http://www.telerik.com/help/aspnet-ajax/grid-basic-grouping.html
but from what I can make out there is something wrong, but I can't figure out what, this is my ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Orders.aspx.vb" Inherits="Orders" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 
<head id="Head1" runat="server">
    <title>Work Orders</title>
</head>
<body>
 
    <form id="form2" runat="server">
           
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server">
    </telerik:RadSkinManager>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
        <script type="text/javascript">
            function ShowEditForm(id, rowIndex) {
                //alert("orderID" + ' ' + id);
                var grid = $find("<%= RadGrid1.ClientID %>");
                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);
                var t = document.getElementById("<%= lblTemplate.ClientID %>").value;
                //alert("row = " + rowIndex);
                var ow = window.radopen("OrderUpdate.aspx?OrderID=" + id + "&Template=" + t, "UpdateWorkOrder");
                //alert("After window open");
                ow.Maximize();
                return false;
            }
            function ShowInsertForm() {
                var t = document.getElementById("<%= lblTemplate.ClientID %>").value;
                var ow = window.radopen("OrderUpdate.aspx?OrderID=0" + "&Template=" + t + "&OrderType=R", "UpdateWorkOrder");
                //alert("After window open");
                ow.Maximize();
                return false;
            }
 
 
            function RowMouseOver(sender, eventArgs) {
                var text = "";
                text += "Work Order Description - ";
                var i = eventArgs.get_itemIndexHierarchical();
                //text += i
                //var firstDataItem = $find("<%= RadGrid1.MasterTableView.ClientID %>").get_dataItems()[0];
                //var keyValues = 'OrderID: "' + firstDataItem.getDataKeyValue("OrderID");
                //
                //<telerik:GridBoundColumn DataField="Text" HeaderText="Text" UniqueName="Text" Display="false">
                //    </telerik:GridBoundColumn>
                //text += ", OrderID: " + keyValues
                //  following 3 lines worked
                var Description = eventArgs.getDataKeyValue("Text")
                text += Description
                document.getElementById("OutPut").innerHTML = text;
 
            }
 
 
 
            function refreshGrid(arg) {
                if (!arg) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }
                else {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
                }
            }
             
 
        </script>
    </telerik:RadCodeBlock>
    <%--<div id="header">
        <h1>
                <asp:Label ID="lblVersion" runat="server" Text="Profess Roads Cost Manager" ForeColor="White"></asp:Label>
        </h1>
    </div>--%>
    <div>
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All"
            ControlsToSkip="Textbox" />
        <table width="100%">
            <tr>
                <td style="width: 100%; text-align: left;">
                    <telerik:RadButton ID="chkShowAll" runat="server" Text="Show All" ButtonType="ToggleButton"
                        ToggleType="CheckBox" />
                    <telerik:RadButton ID="chkRoutine" runat="server" Text="Reactive" ButtonType="ToggleButton"
                        ToggleType="CheckBox" />
                    <telerik:RadButton ID="chkProgrammed" runat="server" Text="Proactive" ButtonType="ToggleButton"
                        ToggleType="CheckBox" />
                    <telerik:RadButton ID="chkCyclic" runat="server" Text="Cyclic" ButtonType="ToggleButton"
                        ToggleType="CheckBox" />
                    <telerik:RadButton ID="chkProject" runat="server" Text="Related by Project" ButtonType="ToggleButton"
                        ToggleType="Radio" GroupName="Related" />
                    <telerik:RadButton ID="chkActivity" runat="server" Text="Order Activity" ButtonType="ToggleButton"
                        ToggleType="Radio" GroupName="Related" />
                    <telerik:RadButton ID="chkServiceProvider" runat="server" Text="Service Provider"
                        ButtonType="ToggleButton" ToggleType="Radio" GroupName="Related" />
                    <telerik:RadButton ID="chkLocation" runat="server" Text="Location" ButtonType="ToggleButton"
                        ToggleType="Radio" GroupName="Related" />
                    <telerik:RadButton ID="chkCategory" runat="server" Text="Order Category" ButtonType="ToggleButton"
                        ToggleType="Radio" GroupName="Related" />
                    <telerik:RadButton ID="chkCostCentre" runat="server" Text="Cost Centre" ButtonType="ToggleButton"
                        ToggleType="Radio" GroupName="Related" />
                    <telerik:RadButton ID="chkAccountCode" runat="server" Text="Account Code" ButtonType="ToggleButton"
                        ToggleType="Radio" GroupName="Related" />
                </td>
                <td style="width: 100%; text-align: right;">
                    <telerik:RadButton ID="btnExport" runat="server" Text="Export" />
                </td>
                <td style="text-align: right;">
                    <asp:RadioButtonList ID="ExportFormat" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem>Excel</asp:ListItem>
                        <asp:ListItem>Word</asp:ListItem>
                        <asp:ListItem>PDF</asp:ListItem>
                        <asp:ListItem>CSV</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
        </table>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
            AllowSorting="True" AutoGenerateColumns="False" EnableAJAX="True" GridLines="None"
            OnRowDataBound="NamesGridView_RowDataBound" PageSize="14"
            DataKeyNames="OrderId" ShowGroupPanel="True" CellSpacing="0">
            <GroupingSettings ShowUnGroupButton="True" />
            <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True"
                ReorderColumnsOnClient="True">
<Selecting AllowRowSelect="True"></Selecting>
 
                <ClientEvents OnRowMouseOver="RowMouseOver"></ClientEvents>
            </ClientSettings>
            <MasterTableView CommandItemDisplay="Top" ClientDataKeyNames="OrderID, Text" DataKeyNames="OrderID">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
                <RowIndicatorColumn Visible="False">
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn Resizable="False" Visible="False">
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn AllowFiltering="false" UniqueName="TemplateEditColumn">
                        <ItemTemplate>
                            <asp:HyperLink ID="EditLink" runat="server" Text="Edit"></asp:HyperLink>
                        </ItemTemplate>
                        <FooterStyle Width="32px" />
                        <HeaderStyle Width="32px" />
                        <ItemStyle Width="32px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="OrderId" GroupByExpression="OrderID" HeaderText="Order Ref"
                        SortExpression="OrderId" UniqueName="OrderId" Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="OrderNum" GroupByExpression="OrderNum" HeaderText="Order Number"
                        SortExpression="OrderNum" UniqueName="OrderNum" Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ProjectRef" HeaderText="Project" UniqueName="ProjectRef"
                        SortExpression="ProjectRef" GroupByExpression="ProjectRef">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Location" HeaderText="Location" UniqueName="Location"
                        SortExpression="Location" GroupByExpression="Location">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CostCentre" HeaderText="Cost Centre" UniqueName="CostCentre"
                        SortExpression="CostCentre" GroupByExpression="CostCentre">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="AccountCode" HeaderText="Account Code" UniqueName="AccountCode"
                        SortExpression="AccountCode" GroupByExpression="AccountCode">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="activityRef" HeaderText="Order Activity" UniqueName="activityRef"
                        SortExpression="activityRef" GroupByExpression="activityRef">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CategoryRef" HeaderText="Type of Work" UniqueName="CategoryRef"
                        SortExpression="CategoryRef" GroupByExpression="CategoryRef">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Order Date" HeaderText="Order Date" UniqueName="OrderDate"
                        SortExpression="Order Date" GroupByExpression="Order Date">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Plan Date" HeaderText="Target Complete" UniqueName="TargetComplete"
                        SortExpression="Plan Date" GroupByExpression="Plan Date">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Actual Date" HeaderText="Actual Complete" UniqueName="ActualComplete"
                        SortExpression="Actual Date" GroupByExpression="Actual Date">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Amount" HeaderText="Estimated Cost" UniqueName="EstimatedCost"
                        SortExpression="Amount" GroupByExpression="Amount">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ServiceProvider" HeaderText="Service Provider"
                        UniqueName="ServiceProvider" SortExpression="ServiceProvider" GroupByExpression="ServiceProvider"
                        Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Text" HeaderText="Text" UniqueName="Text" Display="false">
                    </telerik:GridBoundColumn>
                </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
                <CommandItemTemplate>
                    <table style="width: 100%;">
                        <tr>
                            <td style="width: 50%;">
                                <a href="#" onclick="return ShowInsertForm();">
                                    <img alt="Insert" border="0" height="20" src="App_Images/AddRecord.gif" width="20" />
                                    Add New Record</a>
                            </td>
                            <td align="right" style="width: 50%">
                                <asp:CheckBox ID="chkArchived" runat="server" AutoPostBack="True" OnCheckedChanged="chkShowArchived_CheckChanged"
                                    Text="Show Archived" Width="163px" />
                            </td>
                            <td align="right" style="width: 50%">
                                <asp:CheckBox ID="chkComplete" runat="server" AutoPostBack="True" OnCheckedChanged="chkShowComplete_CheckChanged"
                                    Text="Show Completed" Width="163px" />
                            </td>
                        </tr>
                    </table>
                </CommandItemTemplate>
            </MasterTableView>
            <GroupPanel Visible="True">
            </GroupPanel>
                        <ClientSettings AllowDragToGroup="True" Selecting-AllowRowSelect="true">
            </ClientSettings>
            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <asp:Label ID="lblShowArchived" runat="server" Text="False" Visible="False"></asp:Label>
        <asp:Label ID="lblShowComplete" runat="server" Text="False" Visible="False"></asp:Label>
        <asp:Label ID="lblOrderType" runat="server" Visible="False"></asp:Label>
        <asp:HiddenField ID="lblTemplate" runat="server" />
        <asp:Label ID="OutPut" runat="server" Text=""></asp:Label>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Animation="None"
            Behaviors="Default" InitialBehaviors="None" Left="" Top="" ReloadOnShow="True"
            VisibleStatusbar="false">
        </telerik:RadWindowManager>
    </div>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblUserCount" />
                    <telerik:AjaxUpdatedControl ControlID="RadSlider1" />
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    </form>
</body>
</html>

Thanks for your help
Ryan 

1 Answer, 1 is accepted

Sort by
0
Milena
Telerik team
answered on 12 Nov 2012, 10:25 AM
Hello,

Please use the following syntax when add GroupByExpression to a RadGrid`s column:

GroupByExpression="ColumnName Group By ColumnName "

Note, it is necessary to replace "ColumnName" with the relevant column name..

All the best,
Milena
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.
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Milena
Telerik team
Share this question
or