Articles in this section
Category / Section

How to avoid the exception "Object reference " in .NET MVC Grid?

1 min read

Problem

While configuring the base assembly during run time in the webconfig file, there are chances of confronting the following exception:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description

An unhandled exception occurs during the execution of the current web request. Review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Reason

The runtime binding is not configured in the webconfig for base assembly and thus the above exception is thrown on executing the project.

Solution

You can configure the base assembly in the project by adding the following lines of code in the webconfig file.

<runtime>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <dependentAssembly>

        <assemblyIdentity name="Syncfusion.EJ" publicKeyToken="3d67ed1f87d44c89"/>

        <bindingRedirect oldVersion="0.0.0.0-xx.xxxx.x.xx" newVersion="xx.xxxx.x.xx"/>

      </dependentAssembly>

    </assemblyBinding>

</runtime>


Note: In the above example, xx.xxxx.x.xx denotes the corresponding assembly version to be referred or configured or bound.



Conclusion

I hope you enjoyed learning how to avoid the exception "Object reference " in .NET MVC Grid.

You can refer to ASP.NET MVC Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC Grid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied