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

Filter From Code behind

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 10 Oct 2013, 11:32 AM
Team

I want to filter some option form code behind.

In one popup first name, last name, city is there, IF i entered First Name : Shinu and click on search button then grid will display result start with Shinu

I tried sample code but in my case grid is not refereshing. How to acheive Start with filter from code behind.

THanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Oct 2013, 01:58 PM
Hi Rahul,

I'm not clear about the requirement,i guess you want to set the CurrentFilterFunction as StartsWith,please try the following code snippet.If this doesn't help,please provide your full code snippet and elaborate on your requirements.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
       if (!Page.IsPostBack)
       {
           RadGrid1.MasterTableView.FilterExpression = "([Country] LIKE \'%UK%\') ";
           GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("Country");
           column.CurrentFilterFunction = GridKnownFunction.StartsWith;
           column.CurrentFilterValue = "UK";
           RadGrid1.MasterTableView.Rebind();
       }
   }

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