jQWidgets Forums

jQuery UI Widgets Forums Grid Grid Filter example in asp.net mvc

This topic contains 6 replies, has 2 voices, and was last updated by  balob 13 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Grid Filter example in asp.net mvc #3273

    balob
    Member

    Hi!

    I have tried the grid example with filter in asp.net but get an error. It is on the line:

    var dbResult = db.Database.SqlQuery(this.BuildQuery(query));

    The error message i get in VS2010 is:
    Error 1 ‘jqwidgetTest3___filter.Models.NORTHWNDEntities1’ does not contain a definition for ‘Database’ and no extension method ‘Database’ accepting a first argument of type ‘jqwidgetTest3___filter.Models.NORTHWNDEntities1’ could be found (are you missing a using directive or an assembly reference?) c:\users\ronny\documents\visual studio 2010\Projects\jqwidgetTest3 – filter\jqwidgetTest3 – filter\Controllers\OrdersController.cs 28 31 jqwidgetTest3 – filter

    I think it is because I am referenceing an old version of Entity Framework. But I have installed the latest EF with Nuget and don’t understand why this error appear.

    I hope anyone can help. Thanks.

    Grid Filter example in asp.net mvc #3276

    Minko
    Blocked

    Hello,

    I reproduced that error by removing the reference to the Entity Framework. Could you please double-check your reference or add it again? You can add the reference to the Entity Framework with the following steps:

    1) Right click on your project
    2) Choose “Add Reference”
    3) Select the tab with title “.NET”
    4) Find and select the component with name “Entity Framework”
    5) Click “OK.”

    You also have to check the connection strings in the web.config.
    After that rebuild your project.

    Best regards,

    Minko

    jQWidgets Team
    http://jqwidgets.com/

    Grid Filter example in asp.net mvc #3278

    balob
    Member

    Hi!

    I have checked that the reference to Enitity Framework is there. I also tried to remove and add the reference again. But I still got the error. But when I look in my web.config file I get some warnings:

    – Could not find schema information for the element ‘entityFramework’.
    – Could not find schema information for the element ‘defaultConnectionFactory’.
    – Could not find schema information for the attribute ‘type’.
    – Could not find schema information for the element ‘parameters’.
    – Could not find schema information for the element ‘parameter’.
    – Could not find schema information for the attribute ‘value’.

    I guess this has something to do with my error, but I don’t know why I get these warnings. Everything is autogenerated in my web.config.

    My web.config looks like this:


    Thanks a lot for helping.

    Kind regards.

    Grid Filter example in asp.net mvc #3279

    balob
    Member

    Hi again!

    Forgot to copy my web.config…

    Grid Filter example in asp.net mvc #3280

    balob
    Member

    Hmm… The web.config is removed from my post. I guess it is filtered out. I have put the webconfig on my server as txt file.
    webconfig

    Thanks.

    Grid Filter example in asp.net mvc #3281

    Minko
    Blocked

    Hi balow,

    The web.config on my test project is:

    <?xml version="1.0" encoding="utf-8"?>
    <!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=152368
    -->
    <configuration>
    <appSettings>
    <add key="webpages:Version" value="1.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    </appSettings>
    <system.web>
    <compilation debug="true" targetFramework="4.0">
    <assemblies>
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </assemblies>
    </compilation>
    <authentication mode="Forms">
    <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>
    <pages>
    <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
    </namespaces>
    </pages>
    </system.web>
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
    </assemblyBinding>
    </runtime>
    <connectionStrings>
    <add name="NORTHWNDEntities" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MINKO-PC;Initial Catalog=Northwind;Integrated Security=True;&quot;" providerName="System.Data.EntityClient" />
    <add name="NORTHWNDEntities1" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MINKO-PC;Initial Catalog=Northwind;Integrated Security=True;&quot;" providerName="System.Data.EntityClient" />
    <add name="NORTHWNDEntities2" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MINKO-PC;Initial Catalog=Northwind;Integrated Security=True;&quot;" providerName="System.Data.EntityClient" />
    </connectionStrings>
    </configuration>

    I’ve also uploaded the project from the tutorial and you can download it from here: Server-Side-Filtering.zip

    Best regards,

    Minko

    jQWidgets Team
    http://jqwidgets.com/

    Grid Filter example in asp.net mvc #3282

    balob
    Member

    Hi,

    By studying your project I figured out what I was doing wrong. In the Entity Framework diagram (.edmx file) the tutorial says that I should right click and choose ADO.NET DbContext Generator. In my templates I did only had two templates which where named “ADO.NET EntityObject Generator” and “ADO.NET Self-Tracking Entity Generator”. Since I couldn’t find the one mentioned in the tutorial I did choose the closest one, “ADO.NET EntityObject Generator” and everything seems to work fine (exept for the issue mentioned above) and I didn’t see the connection until now.

    To fix my problem I did choose Online Templates and choosed “EF 4.x DbContext Generator”. After that everyting worked fine. 🙂

    Thanks a lot for your help and thanks for a great project.

    Kind regards,
    Balob

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.