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

Grid isn't working ( syncfusion integrated in an existing MVC5 project 'NET4.5.1')

Hello, 
I integrated Syncfusion ASP.NET MVC (13.1.0.21)  in an existing MVC5 (.net 4.5.1) project
i used the Assemblies version "13.1451.0.21 " of Syncfusion 

i'm calling a Grind in my view, but each time an exception is triggered : 

An exception of type 'System.NullReferenceException' occurred in Syncfusion.EJ.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object. 

Here my VIEW code : 

@(Html.EJ().Grid("VehiculesGrid")
            .Datasource((IEnumerable)Model) // i tested with ViewBag.datasource ( same exception )
        .AllowSorting()
        .AllowPaging()
        .Columns(col =>
        {
             col.Field("Marque").HeaderText("Marque").Width(80).Add(); //The EXCEPTION occurs  in this line
        }))

my Controller code contain this in an ActionResult method : 


            var vehicule = db.Vehicule.Include(v => v.Designation); // This returns a list of Objects of type
            return View(vehicule.ToList());

// i tried this too ( and it still not working )
            var v1 = new Vehicule() {Marque = "test"};
            List<Vehicule> vList = new List<Vehicule>();
            vdd.Add(vList );
            ViewBag.datasource = vList.ToList();


May the problem is my way of integrating the Syncfution to my existing project ?

My method :


I created a new Syncfusion MVC5 project (// The Syncfusion use the .NET 4.5 & my project use the .NET 4.5.1)
and then i copied everything related to syncfusion to my Web.Config and i changed  Vestion=13.1450.0.21 to 13.1451.0.21
ex. <add assembly="Syncfusion.EJ, Version=13.1451.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />

i changed my Layout page & i copied the content & the script

i'm not sure about this part that i add in my web.config file

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <remove name="FormsAuthenticationModule" />
    </modules>
    <handlers>
      <remove name="MvcResourceHandler" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add verb="*" path="captimage.axd" name="syncfusion_generatetools" type="Syncfusion.JavaScript.ImageHandler, Syncfusion.EJ, Version=13.1451.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>

3 Replies

AS Alan Sangeeth S Syncfusion Team April 17, 2015 12:14 PM UTC

Hi Djamel,
Thanks for using Syncfusion products.
Please refer the following kb to resolve the issue “Null reference exception”
http://www.syncfusion.com/kb/3795/how-to-avoid-the-exception-object-reference-not-set-to-an-instance-of-an-object
Please let us know if you have any queries.
Regards,
Alan Sangeeth S


DE Djamel eddine MACHOUK April 18, 2015 07:46 PM UTC

Hello, 
i use this in my web.config File, and now the solution is wroking 

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Syncfusion.EJ" publicKeyToken="3d67ed1f87d44c89"/>
        <bindingRedirect oldVersion="13.1450.0.21" newVersion="13.1451.0.21"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>


Thank you (y).



AS Alan Sangeeth S Syncfusion Team April 20, 2015 05:58 AM UTC

Hi Djamel,
Thanks for the update.
We are happy to hear that your issue has been resolved.
Please let us know if you need any further assistance. We are happy to assist you.
Regards,
Alan Sangeeth S

Loader.
Live Chat Icon For mobile
Up arrow icon