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

radgridview filter

3 Answers 242 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raymond Dalton
Top achievements
Rank 1
Raymond Dalton asked on 11 Feb 2008, 03:24 PM
How do I add a filter value to the grid view programatically?

I have tried several configurations, but I am unable to generate any result.  Here is the latest that seemed to make sense to me:

Within the load event

'adjust the filtering in the grid to defaults you might want
Me.RadGridView1.MasterGridViewInfo.TableFilteringRow.Cells("active").Value = "true"
Me.RadGridView1.MasterGridViewInfo.UpdateFiltering()

where active is the field name.

3 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 11 Feb 2008, 04:15 PM
Hello Raymond,

Thank you for writing. To access the grid's filter functionality, you can use the Columns collection in the MasterGridViewTemplate:

GridViewDataColumn col = radGridView1.MasterGridViewTemplate.Columns["ColumnName"as GridViewDataColumn; 
  
col.Filter.Set("H", GridKnownFunction.StartsWith); 
 

Should you have further questions, do not hesitate to write us back.

Regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
smuschelli
Top achievements
Rank 1
answered on 13 Feb 2008, 07:29 PM
I would like to add where would you do this if you are autogenerating since the column does exist yet.

I was making this call in NeedDatasource....  not sure yet what event this needs to go....

RadGrid1.MasterTableView.FilterExpression =
"([Color] LIKE \'%Camo%\') ";
e.Column.CurrentFilterFunction =
GridKnownFunction.Contains;
e.Column.CurrentFilterValue =
"Camo";

edit: Sorry just saw this is in Windows... this is for a asp.net control...
Steve
0
smuschelli
Top achievements
Rank 1
answered on 13 Feb 2008, 09:28 PM
figured it out...

it goes in the prerender and then rebind the radgrid...

Tags
GridView
Asked by
Raymond Dalton
Top achievements
Rank 1
Answers by
Dwight
Telerik team
smuschelli
Top achievements
Rank 1
Share this question
or