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

Binding grid to linq where date is stored as integer

1 Answer 12 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 16 Mar 2015, 02:07 PM
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?

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 19 Mar 2015, 08:57 AM
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.

 
Tags
Grid
Asked by
Boris
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or