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

GroupByExpressions

4 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 07 Mar 2012, 06:34 PM
I'm persisting the GroupBy expressions for a grid. The grouping is set by the end-user.

I have a problem in that I have a column like this...
<telerik:GridTemplateColumn HeaderText="Template"
                                  SortExpression="Name"
                                  ShowSortIcon="true"
                                  Groupable="true"
                                  DataField="Name"
                                  UniqueName="Name">

Now, when I save the GroupBy expression, I save the value returned by the GroupByExpression's .Expression property.

When I try adding that that as a new GroupByExpression when the user revisits the page, the GroupBy header displays "Name" rather than the column's defined HeadterText of "Template".

Now, I did try serializing the whole of the GroupByExpression, but when I tried deserializing it to recreate the object, it complained that Only Field object can be in the Frieds collection, or something like that.

So, to the question. How can I serialize the GroupByExpression so that I can recreate the grouping with a) the correct field and b) the correct header text for the item in the GroupBy area of the grid?

--
Stuart

4 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 09 Mar 2012, 01:10 PM
The more I think about this, more more convinced I am that the underlying problem is that there's a bug, so I've raised a support ticket.

--
Stuart
0
Pavlina
Telerik team
answered on 12 Mar 2012, 01:30 PM
Hello, Stuart

i already answered your support ticket with the same question and to avoid duplicate posts I will ask you to continue our communication there. Thank you for your understanding in advance.

All the best,
Pavlina
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.
0
rajat
Top achievements
Rank 1
answered on 16 May 2014, 12:50 PM

Is there a way to set some "PageSize" property according the number of "Groups" in a RadGrid with grouping?  

we are using <GroupByExpressions> 

For example : Please check the attachment , in this we have 3 parents and now we set the page size to 2 then we need 2 pages and bottom right corner of the pager should display "Items 1 to 2 of 3"

ASPX:

<telerik:RadGrid ID="RadGrid1"  runat="server"  
        AllowSorting="True" AllowMultiRowSelection="true" AllowPaging="true" ShowGroupPanel="false"  HorizontalAlign="Left"
        AutoGenerateColumns="False" GridLines="None">
  
         <PagerStyle Mode="NextPrevAndNumeric"   PagerTextFormat="Change page: {4} Items {2} to {3} of {5}" 
                                                                    AlwaysVisible="true" />
        <MasterTableView AllowMultiColumnSorting="true"  GroupHeaderItemStyle-HorizontalAlign="Left">
        <HeaderStyle CssClass ="rgHeader" /> 
        
            <Columns>
                <telerik:GridBoundColumn SortExpression="FieldName" HeaderText="Field Name" ItemStyle-HorizontalAlign="left" 
                    HeaderButtonType="TextButton" DataField="FieldName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="From" HeaderText="From" ItemStyle-HorizontalAlign="Left"
                    HeaderButtonType="TextButton" DataField="From">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="To" HeaderText="To" ItemStyle-HorizontalAlign="Left"
                    HeaderButtonType="TextButton" DataField="To">
                </telerik:GridBoundColumn>
            </Columns>
             <GroupByExpressions>
                <telerik:GridGroupByExpression>
                    <SelectFields>
                        <telerik:GridGroupByField  HeaderText="Change" FieldName="ParentHeader" HeaderValueSeparator=" Date: "></telerik:GridGroupByField>
                    </SelectFields>
                    <GroupByFields>
                        <telerik:GridGroupByField FieldName="datefind"   SortOrder="Descending"></telerik:GridGroupByField>
                    </GroupByFields>
                </telerik:GridGroupByExpression>
                
            </GroupByExpressions>
        </MasterTableView>
        <ClientSettings   ReorderColumnsOnClient="false" AllowDragToGroup="false" AllowColumnsReorder="false">
            <Selecting   AllowRowSelect="false"></Selecting>
            <Resizing   AllowRowResize="true"  AllowColumnResize="true" EnableRealTimeResize="false"
                ResizeGridOnColumnResize="false"></Resizing>
        </ClientSettings>
        <GroupingSettings     ShowUnGroupButton="false"  CaseSensitive="false" ></GroupingSettings>
    </telerik:RadGrid>

Please help as this is critical.
0
Pavlina
Telerik team
answered on 21 May 2014, 09:53 AM
Hello Rajat,

In general you can set RadGrid PageSize to whatever value you need. However in current page RadGrid will show only page size GridDataItems regardless whether grouping is applied or not. You can check following example Grid Grouping . If you need to set PageSize to the number of the groups you should manually calculate the groups that will be formed.

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
Pavlina
Telerik team
rajat
Top achievements
Rank 1
Share this question
or