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

Setting Filter on Column Programatically

2 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sharma_deepak
Top achievements
Rank 1
sharma_deepak asked on 25 Sep 2008, 09:09 PM
$0I have a scenario in which I dont want to show the Filter Row and want to handle filtering through my controls and not extending the existing functioanilty and want to do something like this when ever a person clicks Search button$0$0protected void btnSubmit_Click( object sender , EventArgs e )$0$0{ $0$0ClearFilters();$0$0if (ValidationManager.IsNotEmpty(ddlSearch1.SelectedValue))    $0$0{     $0$0 GridColumn Columnn = Grid.MasterTableView.GetColumn("Column1");      Columnn.CurrentFilterFunction = GridKnownFunction.EqualTo;      Columnn.CurrentFilterValue = ddlSearch1.SelectedValue;    $0$0}   $0$0 if (ValidationManager.IsNotEmpty(ddlSearch2.SelectedValue))   $0$0 {     $0$0 GridColumn Columnn = Grid.MasterTableView.GetColumn("Column2");      Columnn.CurrentFilterFunction = GridKnownFunction.EqualTo;      Columnn.CurrentFilterValue = ddlSearch2.SelectedValue;        $0$0  }   $0$0 if (!ddlStatus.SelectedValue.Equals("All"))    {     $0$0 GridColumn Columnn = Grid.MasterTableView.GetColumn("Reviewed");      Columnn.CurrentFilterFunction = GridKnownFunction.EqualTo;      Columnn.CurrentFilterValue = ddlStatus.SelectedValue;  $0$0  }$0$0Grid.DataBind();$0$0}$0$0$0$0$0But the grid is not recocnixing the filters that I apply. Any help would be awesome $0

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 26 Sep 2008, 08:01 AM
Hello Sharma,

You can go through the following online demo link which demonstrates how to filter the grid records after typing a string sequence in a textbox and then hit a button beside that textbox/press the [ENTER] key from the keyboard which is quiet similar to your scenario.
Search on key press/button click

Thanks
Princy.
0
sharma_deepak
Top achievements
Rank 1
answered on 26 Sep 2008, 12:16 PM
Thanks a lot it worked, may I know why setting the filter on the column doesnt works.$0$0$0$0Deepak Sharma$0
Tags
Grid
Asked by
sharma_deepak
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
sharma_deepak
Top achievements
Rank 1
Share this question
or