Reputation: 14846
I have this index view:
@model LeadManager.Models.ProspectingApprovalViewModel
@{
ViewBag.Title = "Index";
}
<h2>Approve Or Reject</h2>
<div class="form-horizontal">
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-group">
<div>
<input type="submit" name="ApprovalAction" value="Approve" class="btn btn-default" />
<input type="submit" name="ApprovalAction" value="Reject" class="btn btn-default" />
</div>
</div>
}
</div>
//model details are below form
I am trying to read the model inside controller like so:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Index(ProspectingApprovalViewModel prospectingApprovalViewModel, string ApprovalAction)
{
//access model
}
I can read ApprovalAction
but the prospectingApprovalViewModel
is null on the postback.
Why is the model not being attached?
Upvotes: 0
Views: 56
Reputation: 31
name="className.propetyName"
. ViewModel
.Upvotes: 1