我将表单发布回服务器,值始终为null。
型号:
public class RDetailsViewModel
{
public RDetailsMaster RDetailsMaster { get; set; }
public ETransaction ETransaction { get; set; }
}
public class RDetailsMaster
{
[Required]
public List<QE_DROPDOWN_MST> Master_EQ { get; set; }
[Required]
public List<QE_DROPDOWN_MST> Master_BASIS { get; set; }
[Required]
public List<QE_DROPDOWN_MST> Master_TE { get; set; }
[Required]
public List<QE_DROPDOWN_MST> Master_ALOP { get; set; }
[Required]
public List<QE_DROPDOWN_MST> Master_RISK { get; set; }
[Required]
public List<QE_DROPDOWN_MST> Master_EXCESS { get; set; }
[Required]
public List<QE_DROPDOWN_MST> Master_CType { get; set; }
}
控制器:
[HttpPost]
public ActionResult RDetails(RDetailsViewModel ObjR)
{
return view();
}
我的观点:
@model QMS_ERater.ViewModels.RDetailsViewModel
@{
ViewBag.Title = "RDetails";
}
<script src="~/Scripts/EAR/RDetails.js"></script>
@using (Html.BeginForm("RDetails", "RDetails", FormMethod.Post))
{
<h2>RDetails</h2>
<div class="well well-sm">
<div id="divDetail101" runat="server">
<div class="row">
<div class="col-sm-4">
<span style="vertical-align: top; color: Red">*</span> EQ :
</div>
<div class="col-sm-3">
@Html.DropDownListFor(m => m.ETransation.EQ, new SelectList(Model.RDetailsMaster.Master_EQ, "VALUE", "DESCRIPTION"), "--Select--", new { style = "width: 100%;" })
</div>
<div class="col-sm-2">
<span style="vertical-align: top; color: Red">*</span> On First Loss Basis :
</div>
<div class="col-sm-3">
@Html.DropDownListFor(m => m.ETransation.BASIS, new SelectList(Model.RDetailsMaster.Master_BASIS, "VALUE", "DESCRIPTION"), "--Select--", new { style = "width: 100%;" })
</div>
<div class="col-sm-4">
<span style="vertical-align: top; color: Red">*</span> Terrorism :
</div>
<div class="col-sm-3">
@Html.DropDownListFor(m => m.ETransation.IS_TE, new SelectList(Model.RDetailsMaster.Master_TE, "VALUE", "DESCRIPTION"), "--Select--", new { style = "width: 100%;" })
</div>
<div class="col-sm-2">
<span style="vertical-align: top; color: Red">*</span> ALOP :
</div>
<div class="col-sm-3">
@Html.DropDownListFor(m => m.ETransation.IS_ALOP, new SelectList(Model.RDetailsMaster.Master_ALOP, "VALUE", "DESCRIPTION"), "--Select--", new { style = "width: 100%;" })
</div>
<div class="col-sm-4">
<span style="vertical-align: top; color: Red">*</span> Wet Risk :
</div>
<div class="col-sm-3">
@Html.DropDownListFor(m => m.ETransation.IS_RISK, new SelectList(Model.RDetailsMaster.Master_RISK, "VALUE", "DESCRIPTION"), "--Select--", new { style = "width: 100%;" })
</div>
</div>
</div>
<input type="submit" value="Submit" />
</div>
}
当我尝试使用call post方法 objR 时,仅为List对象返回NULL值。 任何帮助将不胜感激。 提前谢谢!