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

Need help with Child filterrow

0 Answers 34 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Trey
Top achievements
Rank 2
Trey asked on 22 Oct 2012, 12:39 PM
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);
            }
        }

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Trey
Top achievements
Rank 2
Share this question
or