我有一个使用partialviews加载不同部分的表单。填写完信息后,我希望它在最终的部分视图中显示,以便在提交前提供确认页面。如何获取在一个部分视图上输入的信息并将其显示在最终的提交中?
我的部分视图代码如下所示:
@using (Ajax.BeginForm("PrimaryApplicant", new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = "step3", OnSuccess = "showStep3" }))
{
<h4>Primary Applicant Information</h4>
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<hr/>
<div class="form-group">
@Html.LabelFor(m => m.FirstName, new { @class = "col-md-3 control-label" })
<div class="col-md-9">
<div class="col-md-4">
@Html.TextBoxFor(m => m.FirstName, new { @class = "form-control", placeholder = "First Name" })
</div>
<div class="col-md-4">
@Html.TextBoxFor(m => m.MiddleName, new { @class = "form-control", placeholder = "Middle Name" })
</div>
<div class="col-md-4">
@Html.TextBoxFor(m => m.LastName, new { @class = "form-control", placeholder = "Last Name" })
</div>
@Html.ValidationMessageFor(m => m.FirstName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.SSN, new { @class = "col-md-3 control-label" })
<div class="col-md-9">
<div class="col-md-4">
@Html.TextBoxFor(m => m.SSN, new { @class = "form-control", placeholder = "Social Security Number" })
@Html.ValidationMessageFor(m => m.SSN)
</div>
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.DOB, new { @class = "col-md-3 control-label" })
<div class="col-md-9">
<div class="col-md-4">
@Html.TextBoxFor(m => m.DOB, new { @class = "form-control", type = "date", placeholder = "Date of Birth" })
@Html.ValidationMessageFor(m => m.DOB)
</div>
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Email, new { @class = "col-md-3 control-label" })
<div class="col-md-9">
<div class="col-md-4">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control", type = "email", placeholder="Email Address" })
</div>
@Html.ValidationMessageFor(m => m.Email)
</div>
</div>
我使用模型来创建输入字段及其所有变量。在用户填写一个部分视图上的输入并点击继续后,它将打开下一个部分视图。表格填写完毕后,如何显示最终确认页面,回显他们输入的值?
答案 0 :(得分:0)
每个视图都有一个视图模型。