我有一个视图页面,我正在使用javascript调用另一个视图页面在进度条中部分呈现。单击部分呈现在abc页面中的联系人页面中的下一个按钮时,我应该保存联系页面并移动到下一页谢谢并显示它,但它重定向到联系页面并仅显示"在空白页中为true"。我尝试使用不同版本的jQuery构建此应用程序,但不确定问题是什么。
-------------------------查看1--------abc 页面-----------------
@{
ViewBag.Title = "abc";
}
@{Html.RenderPartial("_progressBar");}
@{Html.RenderPartial("_Contact");}
@{Html.RenderPartial("_ThankYou");}
@Html.ActionLink("Cancel", "Index", "UIS", null, new { @class = "button" })
<div id="modelOTPform">
@{Html.RenderPartial("_otpForm");}
</div>
@Scripts.Render("~/bundles/jquery/myjavascript")
----------------------------------查看2-----------联系页面------------------------
@model myObjectLibrary.ContactObjects
@{
ViewBag.Title = "Contact page";
}
<div class="module module-form">
@using (Ajax.BeginForm("Contact", "UIS", null, new AjaxOptions { HttpMethod = "POST", OnComplete = "HideThisAndShowNext(formContact)" }, new { id = "formContact" }))
{
<fieldset>
<ol>
<li>@Html.LabelFor(x => x.Name) @Html.EditorFor(x => x.Name) @Html.ValidationMessageFor(x => x.Name, "", new { @class = "error" })</li>
</ol>
</fieldset>
<div class="uisNextButton">
@*<input type="button" value="Previous" class = "button" onclick="PreviousFormEvent('formContact')" />*@
<input type="submit" value="Next" class="button rightButton" />
</div>
}
</div>
现在在myjavascript中.js即在WebRole的script文件夹中,我有一个HideThisAndShowNext函数。
function HideThisAndShowNext(e) {
HandleFormVisibility(e.id, false);
}
function HandleFormVisibility(formID,isInitialLoad) {
$("form").parent().hide();
$("form[id='" + formID + "']").parent().show();
if (!isInitialLoad) {
// alert(FetchNextFformID(formID, true));
$("form").parent().hide();
$("form[id='" + FetchNextFformID(formID, true) + "']").parent().show();
//HandleProgressBar(isInitialLoad);
HandleStatuBarClassicWay(isInitialLoad);
BuilMarkup(formID);
}
}
function BuilMarkup(formID) {
if (formID == "formContact") {
var _name = $("#formContact input#name").val();
}
}
终于找到了解决方案!!
在共享布局页面中添加了此项。
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>