Telerik RadGrid Date column filtered by Number

2 posts, 0 answers
  1. L. M. Pathan
    L. M. Pathan avatar
    20 posts
    Member since:
    Dec 2009

    Posted 05 May 2011 Link to this post

    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.

  2. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 10 May 2011 Link to this post

    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">
    <telerik:GridDateTimeColumn DataField="birth" HeaderText="Birth Date" SortExpression="birth" UniqueName="birth" DataFormatString="{0:MM/dd/yyyy}" >

    Hope this helps!
  3. DevCraft R3 2016 release webinar banner
Back to Top