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

Grid Filtering Issue

1 Answer 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 30 Aug 2013, 04:41 PM
I have found that a grid field cannot be sorted by anything other than "EqualTo" method if the data type is Number. This is an issue for me so I am attempting to create a custom filter for this column. The filter control must be a text box only, no button so that it behaves just like the built in filter for a radgrid. I have tried to find some example but have not been able to. Below is the client side code for the column but i am stuck as to what to do next


<telerik:GridBoundColumn DataField="INPUT_BY" UniqueName="INPUT_BY" HeaderText="Input By"
         AllowFiltering="True" AutoPostBackOnFilter="true" ShowFilterIcon="false">
<FilterTemplate>
  <telerik:RadTextBox runat="server" ></telerik:RadTextBox>
 </FilterTemplate>
</telerik:GridBoundColumn>


Again the desired functionality is to replicate the built in filter functionality but it MUST be able to filter using the contains filter method on a Number data type. Any ideas on how to code that up? Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Sep 2013, 06:22 AM
Hi John,

If you set 'AutoPostBackOnFilter' to true for a column having data type number, then the default filter function is 'EqualTo'. I guess your requirement is to hide the filter button and show only the filter textbox and filter the data with filter function 'Contains'. Please try the following code snippet. You don't need to add FilterTemplate in this case.

ASPX:
<telerik:GridBoundColumn DataField="INPUT_BY" UniqueName="INPUT_BY" HeaderText="Input By" AllowFiltering="True" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"   ShowFilterIcon="false" DataType="System.String">
</telerik:GridBoundColumn>

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