Need help with Child filterrow

1 posts, 1 answers
  1. Answer
    Trey
    Trey avatar
    35 posts
    Member since:
    Dec 2006

    Posted 22 Oct 2012 Link to this post

    Basically I have a parent/child layout,and I just need a filter row on the child, but I cannot seem to figure it out!

    Here is what it looks like now:(it only shows the filter for my parent row)





    My code that bind the parent/child:

     private void RecordstoDatGrid(ref RadGridView ParentGrid, DataSet DS)
            {
                foreach (DataTable DT in DS.Tables)
                {
                    if (DT.TableName != "Templates")
                    {
                        GridViewTemplate tmpTemplate = new GridViewTemplate();
                        
                        tmpTemplate.DataSource = DS;
                        tmpTemplate.DataMember = DT.TableName;
                        ParentGrid.Templates.Add(tmpTemplate);
                        GridViewRelation tmpRelation = new GridViewRelation(ParentGrid.MasterTemplate);
                        ParentGrid.MasterTemplate.EnableFiltering = true;
                        ParentGrid.MasterTemplate.EnableGrouping = true;
                        ParentGrid.MasterTemplate.ShowFilteringRow = true;
                        tmpRelation.ParentTemplate = ParentGrid.MasterTemplate;
                        ParentGrid.MasterTemplate.ShowChildViewCaptions = false;
                        tmpRelation.ChildTemplate = tmpTemplate;
                        tmpRelation.RelationName = string.Format("ParentChild_{0}", DT.TableName);
                        tmpRelation.ParentColumnNames.Add("TemplateID");
                        tmpRelation.ChildColumnNames.Add("TemplateID");                   
                        
                        tmpTemplate.Columns["TemplateID"].IsVisible = false;
                        tmpTemplate.AllowColumnChooser = true;
                        tmpTemplate.AllowColumnReorder = true;
                        tmpTemplate.AllowColumnResize = true;
                        tmpTemplate.AllowDragToGroup = true;
                        tmpTemplate.AllowRowReorder = true;
                        tmpTemplate.AllowRowResize = true;

                        tmpTemplate.ShowHeaderCellButtons = true;
                        tmpTemplate.EnableGrouping = true;
                        tmpTemplate.BestFitColumns();
                        tmpTemplate.Caption = DT.TableName;
                        tmpTemplate.ShowChildViewCaptions = false;
                        ParentGrid.ChildRows[0].IsExpanded = true;
                        ParentGrid.TableElement.ShowSelfReferenceLines = true;
                        tmpTemplate.ShowFilteringRow = true;
                        ParentGrid.Relations.Add(tmpRelation);
                        //ParentGrid.Templates[0].HierarchyDataProvider = new GridViewEventDataProvider(ParentGrid.Templates[0]);
                    }
                }
            }


    Any help would be appreciated!


    Never mind everyone, found this nugget in the demo:

     private void SetupFiltering(GridViewTemplate template, bool enableFiltering)
            {
                template.EnableFiltering = enableFiltering;

                for (int i = 0; i < template.Templates.Count; i++)
                {
                    SetupFiltering(template.Templates[i], enableFiltering);
                }
            }
Back to Top