Reputation: 41
I am new to ASP.NET MVC4. I would like to ask if how can I fix this error.
I am rendering another view from another controller. I have a two controllers, Denomination and DenominationPeriod, with each different models. What I want is, render the views of my DenominationPeriod. But I get this error when I try to run the program. "Object reference not set to an instance of an object."
Here is the renderpage code in my Denomination view.
@RenderPage("~/Views/DenominationPeriod/Index.cshtml");
It says that the error is from /Views/DenominationPeriod/Index.cshtml
Please help me. Thanks
Upvotes: 0
Views: 836
Reputation: 5093
I suppose you get an error becuase @RenderPage
uses the same model for the view as the current one. You have mentioned that models are different so please use @Html.RenderPartial
or @Html.RenderAction
and pass required model with arguments.
Upvotes: 1