GridViewComboBoxColumn filter subgrid

4 posts, 1 answers
  1. Dom
    Dom avatar
    18 posts
    Member since:
    May 2011

    Posted 24 Nov 2011 Link to this post

    hi,

    I have a grid and another grid inside it using the : HierarchyChildTemplate.

    In the childtemplate grid, I have 2 : GridViewComboBoxColumn.

    I can easily show the list for the first one, unfortunately, the list of the second depends on the first one. I looked at this example : http://www.telerik.com/help/silverlight/radgridview-columns-column-types-combobox-column.html

    but I don't think i can make it work since I'm in a subGrid and don't have access to all that information.

    Any way to make it work or am I missing something?

    thanks
    Dom
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 25 Nov 2011 Link to this post

    Hello Dom,

    I would recommend you to run through this blog post for a reference. It illustrates how you can define your GridViewComboBoxColumn-s and the business object so that the source of the second column strictly depends on the value selected in the first one.
     

    Greetings,
    Maya
    the Telerik team

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

  3. Dom
    Dom avatar
    18 posts
    Member since:
    May 2011

    Posted 25 Nov 2011 Link to this post

    The example in the blog post, is for one grid.

    Would it work the same if the grid in question is inside a childtemplate? like these tags?

     

     

     

    <telerik:RadGridView.HierarchyChildTemplate>

     

     

     

     

    <DataTemplate>

     

     

     

     

    <telerik:RadGridView

     


    Not sure I have access to the information.
    I'm currently trying to make it work, with no success

    Thanks
    Dom

  4. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 28 Nov 2011 Link to this post

    Hello Dom,

    Actually, there should be no major difference whether you are placing those columns in the main grid or in the hierarchy child template. The only thing that will be needed is to define explicitly the Source property of the ItemsSource of the first column. For example:

    <telerik:GridViewComboBoxColumn Header="Category"
                DataMemberBinding="{Binding CategoryID}"
                ItemsSource="{Binding Categories, Source={StaticResource mainPageViewModel}}"
                DisplayMemberPath="CategoryName"
                SelectedValueMemberPath="CategoryID" />

    Considering the second GridViewComboBoxColumn, you need to set its ItemsSourceBinding to a property from the business object. So, there is no difference whether it is in the child or parent grids, since it depends on the DataContext of the row (which is the data item). 
    Let me know in case you need any further assistance.

    Best wishes,
    Maya
    the Telerik team

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

Back to Top