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

[Solved] Hierarchial Grid View Relations issue

4 Answers 95 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.
Jerves
Top achievements
Rank 1
Jerves asked on 16 Aug 2011, 09:24 PM
We have two Observable collections from the data returned by WCF service
1. Contains data from QuestionCategory table (CategoryId, CategoryName)
2. Contains data from QuestionMaster table (CategoryId, QuestionId,
Question)

We are trying to create a hierarchical grid in Silverlight. We are able to
display main grid with values from QuestionCategory and child grid with
values from QuestionMaster without any relation. When a user clicks on the
expand button of a row in the master grid, its showing all the values in the
child grid and not just the values for that specific CategoryId of the row
where the user clicked.

How can we achieve that?

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 17 Aug 2011, 07:05 AM
Hello Jerves,

You may define a specific query taking the required query parameter. For example:

//Query:
public IQueryable<Order> GetOrdersByCustomerID(string customerID)
        {
                  return this.ObjectContext.Orders.Where(o => o.CustomerID == customerID);
        }
 
//RadDomainDataSource definition:
<telerik:RadDomainDataSource x:Name="orders" QueryName="GetOrdersByCustomerID" AutoLoad="True">
                            <telerik:RadDomainDataSource.DomainContext>
                                <local:CustomerDomainContext />
                            </telerik:RadDomainDataSource.DomainContext>                           
                            <telerik:RadDomainDataSource.QueryParameters>
                                <telerik:QueryParameter ParameterName="customerID" Value="{Binding CustomerID}" />
                            </telerik:RadDomainDataSource.QueryParameters>                         
                        </telerik:RadDomainDataSource>
 
Thus only the orders corresponding to the parent customer item will be displayed in the child grid.

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Jerves
Top achievements
Rank 1
answered on 17 Aug 2011, 05:46 PM
Is there an alternate way of doing this?
Since we are currently not using RadDomainDataSource for binding, we cannot use this snippet.
0
Maya
Telerik team
answered on 18 Aug 2011, 07:03 AM
Hello Jerves,

The correct implementation depends entirely on your specific settings and requirements. The important thing is to call only those items that belong to the parent item. A possible approach may be to handle the RowIsExpandedChanging event and if it is to be expanded, to call the child items, depending to the item in the row being expanded.

 

Best wishes,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Kris
Top achievements
Rank 1
answered on 18 Aug 2011, 01:53 PM
Hi,

What about RadDataServiceDataSource ?
I don't see QueryParameter in this control ?

Can i use this control for hierarchical grid view ?
Tags
GridView
Asked by
Jerves
Top achievements
Rank 1
Answers by
Maya
Telerik team
Jerves
Top achievements
Rank 1
Kris
Top achievements
Rank 1
Share this question
or