Mark Tabor

Mark Tabor

  • 586
  • 2k
  • 461.9k

how to call a partial view having model( mustread the whole)

Oct 8 2019 4:50 AM
hi I have a main view in which i want to call a partial view , but my partial view is not static it is having model and both the models (main view model and partial view model are different) not when i write
@Html.Partial("MyPartialView")
it says that object reference is not set to an instance it mean "Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please 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."
it means i need to call the controller method as well along with partial view how to achieve that basically in partial view i am listing my records .

Answers (3)