We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ASP.NET MVC Grid and EntityFramework support

When I am binding a EntityCollection object to the grid, it gives the invalidcastexception

LicenseInfo object contains LicenseInfoAppServerInfo object.

and I have linq query runs over entity framework.

var licenses = from lc in context.LICENSE_INFO
where lc.Customer.Id == id
select lc;
GridPropertiesModel gridModel = new GridPropertiesModel()
{
DataSource = licenses
};
ViewData["GridModel"] = gridModel;

Unable to cast object of type 'System.Data.Objects.DataClasses.EntityCollection`1[Licensing.Model.LicenseAppServerInfo]' to type 'System.Collections.IList'.

I don't want to create any other custom object like dto.

2 Replies

BM Balaji M Syncfusion Team September 1, 2009 02:41 PM UTC

Hi Cengiz,

Thank you for your interest in syncfusion products.

I am afraid that I am unable to reproduce the reported issue. I have created a simple sample to test this issue and I am able to bind the EntityCollection object to Grid successfully and the sample is available from below link.

http://files.syncfusion.com/support/grid_mvc/Incidents/F89643/MvcSample.zip

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution?.

Please let me know if you have any concerns.

Regards,
M.Balaji.


BM Balaji M Syncfusion Team September 2, 2009 06:48 AM UTC

Hi Cengiz,

Thank you for your interest in syncfusion products.

I am afraid that I am unable to reproduce the reported issue. I have created a simple sample to test this issue and I am able to bind the EntityCollection object to Grid successfully and the sample is available from below link.

http://files.syncfusion.com/support/grid_mvc/Incidents/F89643/MvcSample.zip

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution?.

Please let me know if you have any concerns.

Regards,
M.Balaji.

===================================================================================================

“We have also created a support incident for you under your Direct Trac customer account for this issue, because with Direct Trac, you have access to an assigned engineer who will guide you until this issue is resolved to your satisfaction. You will also be able to take advantage of other customer empowering features like the “Escalate” option and the email alerts that are sent to you when we update the incident.. Please try logging in to Direct Trac from the following location and explore its features and benefits:

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

===================================================================================================

Loader.
Live Chat Icon For mobile
Up arrow icon