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

[Solved] Multiple grouping in RadGrid : It's very urgent.

13 Answers 1034 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ganeshpandi
Top achievements
Rank 1
Ganeshpandi asked on 27 Dec 2007, 08:55 AM

Hi,
     I'm having some problem with the RadGrid grouping.

I want to group the data like this.

Country

City

Description

Austria

 

 

 

Vienna

 

 

 

Desc1

 

 

Desc2

 

Linz

 

 

 

Desc1

Germany

 

 

 

Berlin

 

 

 

Description1

 

Munich

 

 

 

Description1

 

 

Description2

 

 Currently it comes like this.

Country

City

Description

Austria

Vienna

Desc1

Austria

Vienna

Desc2

Austria

Linz

Desc1

Germany

Berlin

Description1

Germany

Munich

Description1

Germany

Munich

Description2

 It's very urgent.

Regards,
Ganeshpandi.M

13 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 02 Jan 2008, 07:13 AM
Hello Ganeshpandi,

Please, take a look at the following online demo (Grid v5.1) to find out how to configure the grouping functionality:

http://www.telerik.com/demos/aspnet/Grid/Examples/GroupBy/GroupLoadModeClient/DefaultCS.aspx

You can also refer to the docs (Grouping part) for more information.

All the best,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ganeshpandi
Top achievements
Rank 1
answered on 02 Jan 2008, 08:27 AM
Hi,
        Thanks for the response.

I checked the online demo. Even in that demo country and city are repeating.

Ex. Argentina is displaying on all three records and the same for City also. It should display only in the group header not in the detail area.


Regards,
Ganeshpandi.M
0
Konstantin Petkov
Telerik team
answered on 02 Jan 2008, 08:53 AM
Hello Ganeshpandi,

Thanks, I see your point now.

This is also achievable - you can hide the grouped column and show it on ungrouping with the help of some code. Please, take a look at the CodeLibrary entry here.

Let us know if that helps.

Greetings,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ganeshpandi
Top achievements
Rank 1
answered on 02 Jan 2008, 10:07 AM
Hi,
    Thanks for your prompt response.

The code, which you had given me is for the dynamic grouping. Because the

GroupsChanging event is fired, when the user drag and drop the field on the Group panel.

But, in my case the grouping is set in the static mode not in the run time. Means, we are not going to allow the user to Group the columns.



Regards,
Ganeshpandi.M

0
Konstantin Petkov
Telerik team
answered on 02 Jan 2008, 02:49 PM
Hi Ganeshpandi,

In this case you can set Visible="false" to the respective column. You can do that either declaratively or in ItemCreated event.

I hope this helps.

Greetings,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ganeshpandi
Top achievements
Rank 1
answered on 04 Jan 2008, 10:39 AM

Hi,
       Thanks for your response.

I did the same  as you suggested.

I want to group the data with two fields. Country and City.

It works fine, If I do it through GroupsChanging event as you suggested earlier. If I drag and drop the field under the GroupPanel it works.

Means it display the group header properly. Country group then under the country group it displays City group.
Austria
                Vienna
                        Record1
                        Record1
                Linz
                        Record1
                        Record1
                        
If I do it declaratively grouping is working.
But, It displays the records like this,
Country:Austria; City:Vienn
                        Record1
                        Record1
Country:Austria; City:Linz
                        Record1
                        Record1

Note:We wouldn't let the user drag and drop the column.




Group Header Format:
I set the GroupHeaderItemStyle HorizontalAlign="Center". But it doesn't work. Header is always displayed on the left side.
And when I do the PDF export, Group header format is ingonred. Ex.changed the fontsize bigger and bold.
Sample Source:

<

telerik:RadGrid ID="rdGridSummary" AutoGenerateColumns="false" GridLines="None" Skin="Outlook" AllowSorting="True" AllowPaging="false" runat="server" Width="98%">
<ClientSettings AllowGroupExpandCollapse="true">

<Resizing AllowColumnResize="true" />

</ClientSettings>

<MasterTableView CellPadding="10" Width="100%" GroupLoadMode="Client">

<GroupHeaderItemStyle Font-Bold="true" Font-Size="Large" HorizontalAlign="Center" />

<GroupByExpressions >

<telerik:GridGroupByExpression>

<GroupByFields>

<telerik:GridGroupByField FieldName="CountryName" HeaderText="Country" HeaderValueSeparator="" />

</GroupByFields>

<GroupByFields>

<telerik:GridGroupByField HeaderText="City" FieldName="City" />

</GroupByFields>

<SelectFields>

<telerik:GridGroupByField FieldName="CountryName" HeaderText="Country" HeaderValueSeparator="" />

<telerik:GridGroupByField HeaderText="City" FieldName="City" />

</SelectFields>

</telerik:GridGroupByExpression>

</GroupByExpressions>

<Columns>

<telerik:GridBoundColumn SortExpression="CountryName" HeaderText="Country" HeaderButtonType="TextButton" DataField="CountryName" HeaderStyle-Width="150px" Visible="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn SortExpression="City" HeaderText="City" HeaderButtonType="TextButton" DataField="City" HeaderStyle-Width="150px" Visible="false">

</telerik:GridBoundColumn>

<telerik:GridTemplateColumn HeaderStyle-Font-Bold="true" HeaderStyle-Font-Size="18" HeaderStyle-Font-Underline="true" HeaderStyle-HorizontalAlign="Center">

<ItemTemplate>

<div style="font-weight:bold; font-size:15;"><%#Eval("TSAElementDescription")%></div><br /><br />

 <%#Eval("SubElementDescription")%><br />

 <br />

 </ItemTemplate>

 </telerik:GridTemplateColumn>

 </Columns>

 </MasterTableView>

 <PagerStyle Mode="NumericPages" Position="Top" HorizontalAlign="Right" BackColor="#eaf2fd"  ForeColor="Navy"></PagerStyle>

</

telerik:RadGrid>

 
Regards,
Ganeshpandi.M

0
Konstantin Petkov
Telerik team
answered on 04 Jan 2008, 04:24 PM
Hi Ganeshpandi,

You have added single GroupByExpression thus the single group you get. Separate the GroupBy/SelectFields in different expressions to achieve the desired result.

As to the HorizontalAlign property, it was not implemented to override the skin style settings. You will find this included in the upcoming Q3 Service Pack scheduled for January 14.

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ganeshpandi
Top achievements
Rank 1
answered on 04 Jan 2008, 05:32 PM
Hi,
       Thanks.

It works.

And as I have two group, Is it possible to have two GroupHeaderItemStyle?

Or Is there any work around?

So, I could apply different style for each group header.

Regards,
Ganeshpandi.M
0
Konstantin Petkov
Telerik team
answered on 07 Jan 2008, 07:12 AM
Hello Ganeshpandi,

You can define custom CSS class in the page which overrides the skin settings (you may need to add !important to respective setting), find the group header item in ItemCreated server-side and set its CssClass to defined name.

Best wishes,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ganeshpandi
Top achievements
Rank 1
answered on 08 Jan 2008, 02:08 PM

Hi,

I have a ItemTemplate column, which has three different fields.

I have applied different style for each through "<span>".

When I run the page, it displays the data properly. But, When I export it to PDF, styles are ignored.

May I know the right way of doing the same? So, all data get exported into PDF properlly.

Please check the following code,

<
Columns>

<telerik:GridTemplateColumn HeaderStyle-CssClass="PHeader" HeaderText="RaWaSIP" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Size="Large">

<ItemTemplate>

<span class="PElement"><%# Eval("TSAElementDescription") %></span><br /><br />

<span class="PSubElement">Findings:</span><br />

<%

# Eval("FindingsDescription") %><br />

<span class="PSubElement">Conclusions:</span><br />

<%

# Eval("ConclusionDescription") %><br />

<br />

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

<PagerTemplate>

Regards,
Ganeshpandi.M

0
Vladimir
Top achievements
Rank 1
answered on 08 Jan 2008, 06:36 PM
Ganeshpandi,

You can use style="" attribute instead of class when exporting to PDF. Please visit this KB for more info:
http://www.telerik.com/support/kb/article/b454K-mea-b454T-bmm-b454c-bmm.aspx

Vlad
0
Ganeshpandi
Top achievements
Rank 1
answered on 15 Jan 2008, 09:13 AM
Hi,
       Could you please confirm, whether the Q3 Service pack released on the said date?

You said in the earlier email it's going to be released on 14th January 2008.


Regards,
Ganeshpandi.M
0
Sebastian
Telerik team
answered on 15 Jan 2008, 09:42 AM
Hello Ganeshpandi,

Q3 2007 SP1 has been postponed for today, it will be announced by the end of the day. Please stand by for the official release of the hotfix version.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Ganeshpandi
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Ganeshpandi
Top achievements
Rank 1
Vladimir
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or