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

How to make filter textbox text null after making a search??..

1 Answer 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 17 Mar 2011, 04:58 AM
hey there,

how can i make the text of the filter textbox to null after making a search.Which event should i use,n how to get the textbox for a particular column??...

thanks
Amit

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 17 Mar 2011, 05:48 AM
Hello Amit,

Try the following code snippet to clear the filter TextBox after filtering.
C#:
bool flag = false;
string columnName = "";
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.FilterCommandName)
    {
        flag = true;
        columnName = ((System.Web.UI.Pair)(e.CommandArgument)).Second.ToString();
    }
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (flag)
    {
      GridColumn column = RadGrid1.MasterTableView.GetColumn(columnName);
      column.CurrentFilterFunction = GridKnownFunction.NoFilter;
      column.CurrentFilterValue = string.Empty;
      RadGrid1.MasterTableView.Rebind();
    }
}

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