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

Binding data to a RadgridView on a Child

4 Answers 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Karim
Top achievements
Rank 1
Karim asked on 05 Oct 2013, 08:42 PM
Hi, I have a WCF Service, my main grid is assigned thru 
ObservableCollection
<
CRM_CommissionBuilder.CRMWCFServiceLocal.new_commission> commission = new ObservableCollection<CRM_CommissionBuilder.CRMWCFServiceLocal.new_commission>(e.Result.OrderBy(q => q.new_appid));
            rgvMonthlyCommission.ItemsSource = commission;
 however, I have child data for selected ids, i have created ChildTaleDefinition, 
<telerik:RadGridView.ChildTableDefinitions>
                           <telerik:GridViewTableDefinition />
                       </telerik:RadGridView.ChildTableDefinitions>
                       <telerik:RadGridView.HierarchyChildTemplate>
                           <DataTemplate>
                               <telerik:RadGridView  ItemsSource="{Binding _commissionEmployee}" x:Name="childGrid" ShowGroupPanel="False">
                                   <telerik:RadGridView.Columns>
 
                                       <telerik:GridViewDataColumn UniqueName="Name"  IsFilterable="False" Header="Name" Width="60" DataMemberBinding="{Binding new_employeename}" />
                                       <telerik:GridViewDataColumn UniqueName="Type"  IsFilterable="False" Header="Type" Width="60" DataMemberBinding="{Binding new_employeetype.Value}" />
                                       <telerik:GridViewDataColumn UniqueName="Commission"  IsFilterable="False" Header="Commission" Width="60" DataMemberBinding="{Binding new_commissionamount.Value}" />
 
                                   </telerik:RadGridView.Columns>
                               </telerik:RadGridView>
                           </DataTemplate>
 
                       </telerik:RadGridView.HierarchyChildTemplate>

The data for _commissionEmployee is for the child grid, however, nothing is populated for the child grid. 
Can I assign value to child grid thru code?  Please advice.  Thanks.

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 07 Oct 2013, 11:31 AM
Hello,

Please note that the data context of the hierarchical GridView is the parent row. Is the _commissionEmployee collection available for the business object bound for the parent row?

You could also subscribe for the Loaded event of the hierarchical RadGridView and assign the ItemsSource there.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Karim
Top achievements
Rank 1
answered on 08 Oct 2013, 03:04 AM
Hi, thanks for your prompt response.  _commissionEmployee is not part of the main grid, its another source, however, the grid datasource and _commissionEmployee share ID together.
Is there a way to connect thru an ID?
You mentioned about subscribing to the Loaded event, in the code behind, can I assign the itemSource property of the child gird, the name of the child gird is, "childGrid".  Thank You.  Karim.
0
Karim
Top achievements
Rank 1
answered on 11 Oct 2013, 12:44 AM
Hi, do you have any feedback to my last response, any help is appreciated.

Regards.
0
Dimitrina
Telerik team
answered on 11 Oct 2013, 12:08 PM
Hello,


As _commissionEmployee is not part of the main grid's bound objects, you cannot link through the ID property. You should specify a valid Source for the ItemsSource of the hierarchical GridView.

For more information on how to configure the Binding, please check this msdn article.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Karim
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Karim
Top achievements
Rank 1
Share this question
or