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

Telerik RadGrid Date column filtered by Number

1 Answer 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L. M. Pathan
Top achievements
Rank 1
L. M. Pathan asked on 05 May 2011, 04:22 PM
Telerik Team,

I am using Telerik Grid and have Date column (using <telerik:GridBoundColumn) with DataFormatString="{0:MM/dd/yyyy}" and everything works fine. But when I enter number like 5 in the filter bar and select Equal To from filter criteria, an client side error appears. Error only comes in IE, other browsers like FF, Chrome and Safari don't respond at all and grid doesn't get filtered. I tried to debug and it say String is not valid DateTime. Please advise how do I handle this.

Thank you so much for any help.

Regards

1 Answer, 1 is accepted

Sort by
0
Gimmik
Top achievements
Rank 1
answered on 10 May 2011, 05:27 PM
Hi L.M. ,

This is a very simple fix. Use <telerik:GridDateTimeColumn> instead of <telerik:GridBoundColumn>. This will make the filter have a built in calender and also provide input validation for manually entered dates. Here's an example.

<telerik:RadGrid DataSourceID="SqlDataSource1" ID="RadGrid1" runat="server" GridLines="None" AutoGenerateColumns="false"  AllowFilteringByColumn="true">
<MasterTableView DataSourceID="SqlDataSource1" TableLayout="Auto">
 
<Columns>
<telerik:GridDateTimeColumn DataField="birth" HeaderText="Birth Date" SortExpression="birth" UniqueName="birth" DataFormatString="{0:MM/dd/yyyy}" >
</telerik:GridDateTimeColumn>
</Columns>
 
</MasterTableView>
 
 
</telerik:RadGrid>


Hope this helps!
-Gimmik
Tags
Grid
Asked by
L. M. Pathan
Top achievements
Rank 1
Answers by
Gimmik
Top achievements
Rank 1
Share this question
or