C1GridView Binding to Entity Framework 6

Originally Posted 3 July 2016, 2:50 pm EST

  • Originally Posted 3 July 2016, 2:50 pm EST

    I'm using EF6 and when ever I try to a an EF datasource I get a message saying I need to install Microsoft.AspNet.EntityDataSource from Nuget. I did that and am still getting the message.

    Any ideas how to fix this?
    David McCarter
  • Reply

    Hello David.

    Per the following link:


    You need to install the Microsoft.AspNet.DynamicData.EF-Provider and Microsoft.AspNet.EntityDataSource NuGet packages.

    Then follow the instructions on the bottom of the page. My web.config was already modified to include the addtagPrefix="ef" ... section they listed but I had to modify my default.aspx page to change the existing (created when I tried to create the connection via DataSource > AddNew and got the EF5 message) to (note the change in prefix).

    Then, per the EF5 message "If you're not using Entity Framework 5 you can configure the control by editing the markup on the page". It appears that they didn't build an EF6 version of the wizard that helps configure all the settings for the EntityDataSource control. I had previously created a separate project using EF5 and had already completed the configuration so I copied over the markup and rebuilt the project and it worked.

    Below is the complete code from my default.aspx

    <wijmo:C1GridView ID="C1GridView1" runat="server" AllowVirtualScrolling="False" AutogenerateColumns="True" DataSourceID="EntityDataSource1">

    <ef:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=NorthwindEntities" DefaultContainerName="NorthwindEntities" EnableFlattening="False" EntitySetName="Orders">

    I have a C1GridView on a page with it's DataSourceID = EntityDataSource1 and AutoGenerateColumns = True. I have an EntityDataSource control named EntityDataSouce1 with the ef prefix and with the ConnectionString, DefaultContainerName and EntitySetName properties set to point to my existing Northwind Orders table EF6 instance.

    I was able to successfully build and run my project and display the Orders table.

    Please let me know if you have any questions or any issues.

    Thank you.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels