Binding data to a RadgridView on a Child

5 posts, 0 answers
  1. Karim
    Karim avatar
    3 posts
    Member since:
    May 2013

    Posted 05 Oct 2013 Link to this post

    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.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 07 Oct 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Karim
    Karim avatar
    3 posts
    Member since:
    May 2013

    Posted 07 Oct 2013 Link to this post

    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.
  5. Karim
    Karim avatar
    3 posts
    Member since:
    May 2013

    Posted 10 Oct 2013 Link to this post

    Hi, do you have any feedback to my last response, any help is appreciated.

    Regards.
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Oct 2013 Link to this post

    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 >>
Back to Top
DevCraft banner