Skip to content
Advertisement

Parameters in ASP.NET MVC to create a PDF

I have a particular problem, I am working with ASP.NET MVC in C# and SQL Server. The idea is that on the main screen you see a text box and a button, entering a number that brings us our data. By bringing that data, the person can choose whether they want to see if that data in a PDF. But, when I try to carry out those data to the pdf the problem arises that I will show.

Index:

Controller:

ChRoja:

So the problem is that when I press to view the PDF values ​​of the query the following happens:

System.NullReferenceException: ‘Referencia a objeto no establecida como instancia de un objeto.’

enter image description here

Any suggestions?

Advertisement

Answer

you are using the wrong constructor for Html.ActionLink. There is an answer here.

Solution for your case is to add a parameter “Home” for the controller’s action, as well as null at the end for htmlattributes.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement