我有两个模型,我使用Tuple像这样实现它
@using WorkFlowManagement.Entity
@model Tuple<FormModel, ExternalDataModel>
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@using (Html.BeginForm("AddEdit", "Form", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div class="col-sm-3 paddingVarTop">
Form Title<span class="required-symbol"> *</span>
</div>
<div class="col-sm-5">
@Html.TextBoxFor(m => m.Item1.FormTitle, new { @maxlength = "100", @class = "form-control" })
</div>
<div class="col-sm-4">
<span class="required-symbol"> @Html.ValidationMessageFor(m => Model.Item1.FormTitle)</span>
</div>
<button type="submit" class="btn btn-primary" id="saveForm"> Save</button>
}
我想在控制器中访问FormTitle如何操作。下面是控制器的代码,当前为FormTitle返回null值:
public ActionResult AddEdit(FormModel _Form)
{
string title = _Form.FormTitle;
return RedirectToAction("Index", "Form");
}