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

Filter Child Grid

1 Answer 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Orit
Top achievements
Rank 1
Orit asked on 25 Aug 2009, 08:02 AM
Hello
I want to filter my child grid
when I watch the DateView dv it is filtered
but in the child grid I still see all the rows and not only the filtered rows
this is my code

 private void OnChildGridLoaded(object sender, RoutedEventArgs e)  
        {  
            // Pull data from the detail table based on the relation.  
            var dataRowView = (DataRowView)((RadGridView)sender).ParentRow.DataContext;  
            var ds = dataRowView.DataView.Table.DataSet;  
            var childData = dataRowView.CreateChildView(ds.Relations["BudgetRelation"]);  
            if (((ComboBoxValues.ComboValues)cmbActivityType.SelectedValue).Id != 0)  
            {  
                dv = new DataView(childData.ToTable(), "ActivityTypeID=" + ((ComboBoxValues.ComboValues)cmbActivityType.SelectedValue).Id, "", DataViewRowState.CurrentRows);  
                ((RadGridView)sender).DataContext = dv;  
            }  
            else   
                ((RadGridView)sender).DataContext = childData;  
 
            ((GridViewComboBoxColumn)((RadGridView)sender).Columns["ActivityTypeName"]).ItemsSource = ComboBoxValues.GetComboValues(dtActivityType);  
        } 

Thanks

By the way, I'm still waiting for an answer about second child hierarchy.

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 27 Aug 2009, 02:40 PM
Hello Orit,

Is there a reason for setting the DataContext of the grid instead of its ItemsSource?

Anyway, we will need the whole project in order to debug it. This code-snippet would not be enough.

Please send it to us and we will take a look at it.

Best wishes,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Orit
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or