我有一个如下所述的视图:
@model Hello.Web.Models.ClaimDataViewModel
@{
ViewBag.Title = "Index";
}
@using (Ajax.BeginForm("Index", "Search", new AjaxOptions { UpdateTargetId = "divWebGrid", InsertionMode = InsertionMode.Replace, LoadingElementId = "imgLoad" }))
{
//some code
}
@if (Model != null && Model.ClaimDataViewModelList != null)
{
<div class="panel panel-default" id="divWebGrid">
<div class="panel-heading panel-heading-sm" style="padding:5px 0px 0px 5px;" >
<h5 class="panel-title"><b>Search Results:</b></h5>
</div>
<div class="panel-body">
@{Html.RenderPartial("_Index", Model.ClaimDataViewModelList);}
</div>
</div>
}
然后我有一个部分观点:
@model IEnumerable<Hello.Web.Models.ClaimDataViewModel>
@if (Model.Count() > 0)
{
<table id="tblSearchRecords" class="table table-hover table-condensed">
<thead>
<tr>
<th style="visibility:hidden;"></th>
<th>Claim#</th>
<th>Status</th>
<th>Due Date</th>
<th>Claimant</th>
<th>Insured Name</th>
<th>Claim Handler</th>
<th style="text-align:center;">Full Value</th>
<th style="text-align:center;">Opt Out</th>
<th style="text-align:center;">Reassign</th>
<th></th>
</tr>
</thead>
<tbody>
@for (int i = 0; i < Model.Count(); i++ )
{
<tr>
<td>@Html.RadioButton("rbCheck", new { ClaimDataId = Model.ElementAt(i).ClaimDataId })</td>
<td>@Html.ActionLink(Model.ElementAt(i).ClaimNum + "-" + Model.ElementAt(i).LineSuffix, "")</td>
<td>
@if (Model.ElementAt(i).MRPLineStatus == "PENDG")
{ <p>Pending</p> }
else if (Model.ElementAt(i).MRPLineStatus == "INPRG")
{ <p>In Progress</p> }
else if (Model.ElementAt(i).MRPLineStatus == "COMPL")
{ <p>Complete</p> }
else if (Model.ElementAt(i).MRPLineStatus == "OPOUT")
{ <p>Opt Out</p> }
</td>
<td>@Html.DisplayFor(m => m.ElementAt(i).DueDate)</td>
<td>@Html.DisplayFor(m => m.ElementAt(i).ClaimantName)</td>
<td>@Html.DisplayFor(m => m.ElementAt(i).InsuredName)</td>
<td>@Html.DisplayFor(m => m.ElementAt(i).ClaimHandlerName)</td>
<td style="text-align:right;">@Html.DisplayFor(m => m.ElementAt(i).FullValueAmt)</td>
<td style="text-align:center;">@Html.CheckBoxFor(m => m.ElementAt(i).IsOptOut)</td>
<td style="text-align:center;">@Html.CheckBoxFor(m => m.ElementAt(i).IsReassigned)</td>
<td>
@if (Model.ElementAt(i).DueDate < DateTime.Now)
{
<span class="glyphicon glyphicon-alert" style="color:red"></span>
}
</td>
</tr>
}
</tbody>
</table>
<hr />
<div class="row">
<div class="col-sm-3">
<div class="input-group input-group-sm" style="max-width: 250px;">
<span class="input-group-addon">Reassign To:</span>
@Html.DropDownList("ddlReassignTo", (IEnumerable<SelectListItem>)ViewBag.ReviewerList, new { @class = "form-control" })
</div>
</div>
<div class="col-sm-5">
<div class="input-group input-group-sm" style="width: 200%;">
<span class="input-group-addon">Opt Out Reason:</span>
<input type="text" class="form-control" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-offset-10 col-sm-1">
@*<button type="submit" class="btn btn-sm btn-primary pull-right"><span class="glyphicon glyphicon-floppy-save"> </span>Save</button>*@
@Html.ActionLink("Save", "SaveUpdatedClaims", "Search", new { }, new { @id = "btnTEST", @class = "btn btn-sm btn-primary pull-right" })
</div>
<div class="col-sm-1">
@*<button type="submit" class="btn btn-sm btn-primary" id="btnOpenMr"><span class="glyphicon glyphicon-eye-open"> </span>Open MR</button>*@
@Html.ActionLink("Open MR", "RedirectToReview", "Search", new { }, new { @id = "btnOpenMr", @class = "btn btn-sm btn-primary pull-right" })
</div>
</div>
}
else
{
<div class="alert alert-warning"><b>No records found !</b></div>
}
现在,当我点击部分视图上的“保存”按钮时,我的动作方法模型中出现空值。
谁能告诉我这里有什么问题?
更新
以下是行动方法:
[HttpPost]
public ActionResult SaveUpdatedClaims(IEnumerable<ClaimDataViewModel> model)
{
return View();
}
答案 0 :(得分:0)
因为您的模型是list type @model IEnumerable<Hello.Web.Models.ClaimDataViewModel>
而您accepting object type Hello.Web.Models.ClaimDataViewModel
正在行动中。
还缺少form
标记