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

Clear text-box value on button click

1 Answer 494 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 22 May 2012, 01:56 PM
Hai,
     I have a radgrid where filtering is enabled. I have added a button in the commanditemtemplate and tried to clear the filtered textbox value on the button click but its not working. Can anybody suggest where i went wrong and come up with some idea to implement this effectively.
Ryan

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 May 2012, 02:09 PM
Hi Ryan,

Try the following code snippet to clear the filters by a Button click.

ASPX:
<CommandItemTemplate>
    <asp:Button ID="Button" runat="server" Text="clear filter" onclick="Button_Click" />
</CommandItemTemplate>

C#:
protected void Button_Click(object sender, EventArgs e)
{
    RadGrid1.MasterTableView.FilterExpression = string.Empty;
    RadGrid1.MasterTableView.Rebind();
}

Hope this helps.

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