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

[Solved] Grouping by the another tables Field when linked by ID

2 Answers 110 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
COSOL
Top achievements
Rank 1
COSOL asked on 04 Jan 2011, 08:01 AM
Hi Guys,

I have two tables, Employees and Suburbs. Suburbs has an ID (you can add suburbs separately). Each Employee has "Employee.Suburb". I'm using RIA Services to get the data to the client side and binding to a grid. When displaying an Employee in GridView, I want to group them by Employee.Suburb.Name, not Employee.SuburbID. I can't find a way of doing this, I assume it's similar to how a combo boxes work in this column: http://www.telerik.com/help/silverlight/radgridview-columns-column-types-combobox-column.html

If you could provide me with any information on this I would be extremely gracious.

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 04 Jan 2011, 09:37 AM
Hi Mark,

A possible approach may be to use the GroupHeaderTemplate of the grid and manage the value displayed inside:

<telerik:RadGridView Name="clubsGrid"
                     ItemsSource="{Binding Clubs}">
        <telerik:RadGridView.GroupHeaderTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Group.Key}"/>
            </DataTemplate>
        </telerik:RadGridView.GroupHeaderTemplate>
</telerik:RadGridView>
 
The Group.Key is the value that is displayed and you may try to rearrange it according to your requirements. However, in case that does not correspond to your exact necessities, I would need a bit more details about your settings. How do you display the name of the Suburb in the grid ? Is it appropriate for you to use the GridViewComboBoxColumn ? Basically, any additional relevant information about your application would be of further help. 

Kind regards,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
COSOL
Top achievements
Rank 1
answered on 05 Jan 2011, 01:26 AM
Hi,

Thanks for the quick response, I realised that it was more of a EntitySet issue, and that if I didn't have the value available for the grid to group by then there was really no point. I found out how to do what I needed here: http://jesseliberty.com/2009/09/07/project-turing-multiple-tables-ria-services-2/
Tags
GridView
Asked by
COSOL
Top achievements
Rank 1
Answers by
Maya
Telerik team
COSOL
Top achievements
Rank 1
Share this question
or