2 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 15 Dec 2009, 04:33 AM
Hi Bogice,
You can try the following code snippet in order to clear the filters and to restore the initial grid content.
CS:
Also checkout the following demo: Grid / Google-like Filtering
-Shinu.
You can try the following code snippet in order to clear the filters and to restore the initial grid content.
CS:
| protected void Button1_Click(object sender, EventArgs e) |
| { |
| RadGrid1.MasterTableView.FilterExpression = string.Empty; |
| RadGrid1.MasterTableView.Rebind(); |
| } |
Also checkout the following demo: Grid / Google-like Filtering
-Shinu.
0
Bogice
Top achievements
Rank 1
answered on 15 Dec 2009, 03:50 PM
Hi Shinu,
Im not able to get those code work on the the grid has both GridBoundColumn and GridTemplateColumn.
Here are the code snipset:
----------------------------------------------------------------------------------------------------------------
...... .cs code behind
---- aspx -----------------------------------------------------------------------------------------------------------------------------
Thank you
Im not able to get those code work on the the grid has both GridBoundColumn and GridTemplateColumn.
Here are the code snipset:
----------------------------------------------------------------------------------------------------------------
...... .cs code behind
| protected void cmdReload_Click(object sender, ImageClickEventArgs e) |
| { |
| grdDevices.MasterTableView.FilterExpression = string.Empty; |
| foreach (GridColumn column in grdDevices.MasterTableView.RenderColumns) |
| { |
| if (column is GridBoundColumn || column is GridTemplateColumn) |
| { |
| GridEditableColumn editableColumn = column as GridEditableColumn; |
| editableColumn.CurrentFilterValue = ""; |
| } |
| } |
| grdDevices.Rebind(); |
| } |
---- aspx -----------------------------------------------------------------------------------------------------------------------------
| <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" |
| ShowFilterIcon="false" DataField="IP" SortExpression="IPSortable" HeaderText="Address" |
| UniqueName="IP"> |
| <ItemStyle Width="80px" /> |
| <HeaderStyle Width="80px" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" |
| ShowFilterIcon="false" DataField="Name" HeaderText="Name" UniqueName="Name"> |
| <ItemStyle Width="100px" /> |
| <HeaderStyle Width="100px" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" |
| ShowFilterIcon="false" DataField="Location" HeaderText="Location" UniqueName="Location"> |
| <ItemStyle Width="80px" /> |
| <HeaderStyle Width="80px" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" |
| ShowFilterIcon="false" HeaderText="Notes" UniqueName="Notes"> |
| <ItemTemplate> |
| <div style="width: 120px; word-wrap: break-word"> |
| <asp:Literal ID='Details' runat='server' Text='<%# Eval("Notes") %>'></asp:Literal> |
| </div> |
| </ItemTemplate> |
| <ItemStyle Width="140px" /> |
| <HeaderStyle Width="140px" /> |
| </telerik:GridTemplateColumn> |
Thank you