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

Google Like Filtering to nested grid

5 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 02 Mar 2009, 05:32 AM
Hello All,
    I have used three level hierarchy of grid in my webisite. I want google like filtering to inner two grid in the hierarchy. Can you provide me any sample. How should i do google like filtering to inner grid.

Thanks
Rahul

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Mar 2009, 11:13 AM
Hi Rahul,

In the PreRender event you can access the NestedTableView and then clear the columns to add the custom filtering column . I have made use of the code snippet in the help document  http://www.telerik.com/help/aspnet-ajax/grdtraversingdetailtablesitemsingrid.html

C#
protected void  RadGrid1_PreRender(object sender, EventArgs e) 
     { 
         foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items) { 
             if (dataItem.Expanded) { 
                 GridTableView gridTableView = (GridTableView)dataItem.ChildItem.NestedTableViews[0]; 
                 gridTableView.Columns.Clear(); 
                 foreach (DataColumn dataColumn in ds.Tables[0].Columns) 
               { 
                     RadGrid.MyCustomFilteringColumn gridColumn = new RadGrid.MyCustomFilteringColumn(); 
                     
                     gridColumn.DataField = dataColumn.ColumnName; 
                     gridColumn.HeaderText = dataColumn.ColumnName; 
                     gridTableView.Columns.Add(gridColumn); 
                 } 
                 gridTableView.Rebind(); 
             } 
         } 
         
         
     } 
 
 

Thanks,
Princy
0
Princy
Top achievements
Rank 2
answered on 02 Mar 2009, 11:23 AM
Hi Rahul,

In the PreRender event you can access the NestedTableView and then clear the columns to add the custom filtering column . I have made use of the code snippet in the help document  http://www.telerik.com/help/aspnet-ajax/grdtraversingdetailtablesitemsingrid.html

C#
protected void  RadGrid1_PreRender(object sender, EventArgs e) 
     { 
         foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items) { 
             if (dataItem.Expanded) { 
                 GridTableView gridTableView = (GridTableView)dataItem.ChildItem.NestedTableViews[0]; 
                 gridTableView.Columns.Clear(); 
                 foreach (DataColumn dataColumn in ds.Tables[0].Columns) 
               { 
                     RadGrid.MyCustomFilteringColumn gridColumn = new RadGrid.MyCustomFilteringColumn(); 
                     
                     gridColumn.DataField = dataColumn.ColumnName; 
                     gridColumn.HeaderText = dataColumn.ColumnName; 
                     gridTableView.Columns.Add(gridColumn); 
                 } 
                 gridTableView.Rebind(); 
             } 
         } 
         
         
     } 
 
 

Thanks,
Princy
0
Princy
Top achievements
Rank 2
answered on 02 Mar 2009, 11:24 AM
  
0
Rahul
Top achievements
Rank 1
answered on 02 Mar 2009, 11:25 AM
Hi Princy
  When i click on the link provided by you it cannot find the page.

  One more thing
  I have have write the code on "GridDetailTableDataBindEventArgs" event of the RadGrid and implement google like filtering in that
  function. When i click on the combo box it gives me following error.

  The target 'ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl06$Detail10$ctl02$ctl02$RadComboBox1fname' for the callback could not be found or did not implement ICallbackEventHandler.

 I have used following code.

  protected void DetailsBinding(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {

            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
            switch (e.DetailTableView.Name)
            {
                case "ABC":
                    {
                        //string CustomerID = dataItem.GetDataKeyValue("ConsultID").ToString();
                        DataTable dt = GetPatientDataTable();
                        foreach (DataColumn dataColumn in dt.Columns)
                        {

                            if (dataColumn.ColumnName != "Edit" && dataColumn.ColumnName != "Details" && dataColumn.ColumnName != "Status")
                            {

                                MyCustomFilteringColumnCS gridColumn = new MyCustomFilteringColumnCS();
                                //this.consultantgrid.MasterTableView.Columns.Add(gridColumn);
                                //RadGrid1.MasterTableView.Columns.Add(gridColumn);
                                e.DetailTableView.Columns.Add(gridColumn);
                                gridColumn.DataField = dataColumn.ColumnName;
                                gridColumn.HeaderText = dataColumn.ColumnName;
                                gridColumn.ShowSortIcon = false;
                                gridColumn.AllowFiltering = true;
                             
                            }
                        }

                        e.DetailTableView.DataSource = dt.DefaultView;
                        break;
                    }

                case "PQR":
                    {
                        // string OrderID = dataItem.GetDataKeyValue("ConsultID").ToString();
                        e.DetailTableView.DataSource = GetPatientDataTable();
                        break;
                    }
            }

                   }


Please help me. I will try the above code and get back to you.

  Thanks
   Rahul

0
Rahul
Top achievements
Rank 1
answered on 02 Mar 2009, 11:44 AM
Hi Princy,
 I have tried code given by you. When i click on combo box to display filtering it displays only loading.... When i try to debug then
it dose not go to "list_ItemsRequested" function in "MyCustomFilteringColumnCS" class file..

Help me..?

Thanks
Rahul
Tags
Grid
Asked by
Rahul
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Rahul
Top achievements
Rank 1
Share this question
or