Binding grid to linq where date is stored as integer

2 posts, 0 answers
  1. Boris
    Boris avatar
    18 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
    Kostadin avatar
    1733 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.


    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.

Back to Top