I'm having trouble with this line of code: @{Html.RenderPartial("Form", Model.Contact);}
This is the error I'm getting:
The model item passed into the dictionary is of type 'ContactWeb.Models.RoleListViewModel', but this dictionary requires a model item of type 'ContactWebLibrary.Contact'.
I have RoleListViewModel listed at the top of the view and I have Contact property in my RoleListViewModel so I'm not sure why it's complaining. Can anyone please help me to fix this problem? Thanks.
As a third parameter, you need to pass in a new ViewDataDictionary.
In response to your comment:
"In the Form, on the line , it is giving a NullReferenceException that the object reference is not set to the instance of an object."
MVC3 requires that you use the Html Helper to pass input as it adds some additional markup.
@Html.Hidden("currentId", @Model.Id)
And then in your [HttpPost] controller
public ActionResult someController(int currentId)
{
//Use current Id
return RedirectToAction("responseController");
}