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

Radgrid grouping

2 Answers 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 21 Apr 2012, 08:12 PM
Hi,

I'm experiencing an issue with radgrid grouping. Apparently the grid is only sorting by date but not grouping by date. For example; If I had 5 entries for 4/20/2012 I would expect a group for the date and five sub entries. But what I'm experiencing is 5 separate groups. I attached a screenshot to give you an idea. I really appreciate your help.
<telerik:RadGrid runat="server" ID="grdRecentActivity" DataSourceID="objActivity" Width="99%" Skin="Sunset" ShowHeader="false"
                          onitemdatabound="grdRecentActivity_ItemDataBound">
                      <HeaderStyle CssClass="HistoryGridHeader" />
                       <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
                       <MasterTableView AutoGenerateColumns="false" CssClass="GridRecentActivity" GroupLoadMode="Client" ExpandCollapseColumn-Groupable="False">
                           <GroupByExpressions>
                               <telerik:GridGroupByExpression>
                                   <SelectFields>
                                       <telerik:GridGroupByField  FieldName="Date" FormatString="{0:D}" FieldAlias="Date"
                                        HeaderText=" " />
                                   </SelectFields>
                                   <GroupByFields>
                                       <telerik:GridGroupByField FieldName="Date" SortOrder="Descending" FieldAlias="StartDateTime"
             FormatString="{0:dd/MM/yy}"    >
                                       </telerik:GridGroupByField>
                                   </GroupByFields>
                               </telerik:GridGroupByExpression>
                           </GroupByExpressions>
                           <Columns>
                               <telerik:GridTemplateColumn DataField="Message" HeaderText="Message" UniqueName="Message">
                                   <ItemTemplate>
                                       <asp:Label runat="server" id="Label1" Text='<%# Eval("Type") %>' CssClass="FirstColumn" />   -  
                                       <asp:Label runat="server" id="lblMessage" Text='<%# Eval("Message") %>' />
                                   </ItemTemplate>
                               </telerik:GridTemplateColumn>
                           </Columns>
                       </MasterTableView>
                       <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                           <Selecting AllowRowSelect="True"></Selecting>
                           <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True"
                           ResizeGridOnColumnResize="False"></Resizing>
                   </ClientSettings>
                   </telerik:RadGrid>

Thanks,
Ron.

2 Answers, 1 is accepted

Sort by
0
Accepted
BabaYa
Top achievements
Rank 1
answered on 23 Apr 2012, 08:50 AM
Hi

I see you display data in dd/MM/yy format, but you sure that your time part is same. if you have 4/20/2012 18:00:00 and 4/20/2012 09:00:00 may be thats why groups is diferent.

Thanks,
BabaYa
0
Ron
Top achievements
Rank 1
answered on 23 Apr 2012, 12:47 PM
Babaya,

Thanks a million, that worked. Problem was in my database the column type was datetime which created a separate entry because each row had a different time even if it had the same date. By changing the column type from datetime to date it removed the time string and that fixed everything.

Thanks,
Ron.
Tags
Grid
Asked by
Ron
Top achievements
Rank 1
Answers by
BabaYa
Top achievements
Rank 1
Ron
Top achievements
Rank 1
Share this question
or