Binding grid to linq where date is stored as integer

2 posts, 0 answers
  1. Boris
    Boris avatar
    7 posts
    Member since:
    Feb 2015

    Posted 16 Mar 2015 Link to this post

    I want to bind a grid to a linqdatasource. The date in the db as stored as an integer like so 20070205 (YearMonthDay).
    When I try toconvert the int to a date in the linq query like so
    var q = from i in ICILOCs
    select i.LASTRCPTDT.ToString("MM/dd/yyyy");
    I get an error:
    Method 'System.String ToString(System.String)' has no supported translation to SQL.

    I can load the results into memory with ToList() and then parse it. The problem is I will loose the efficient paging with the grid. 
    Or I can parse it on ItemDatabound, the problem is that how will I set the filter for this field in the grid? It should a calendar dropdown, not an integer textbox.
    Do you have any solution for this?
  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 19 Mar 2015 Link to this post

    Hi Boris,

    I would recommend you to try the approach from the following forum tread and check this will helps.

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top