我的观点是发送一个ActionLink,在对话框中打开一个表单
@Ajax.ActionLink("Screen", "ExcQuestions", "Home", new {Student=item.StId, Formid = item.FormId}, new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "questions", InsertionMode = InsertionMode.Replace, OnSuccess = "openDialog" })
在同一视图中我定义了一个div
<div id="questions"></div>
我的openDialog功能是
function openDialog() {
$("#questions").dialog({
autoOpen: false,
title: 'Exclusions',
width: 550,
height: 'auto',
modal: true
});
$("#questions").dialog("open");
}
和对话框中打开的另一个局部视图是
@model IList<ViewModels.Questions>
<div id="questionsdialog">
@using(Ajax.BeginForm("saveAnswers","Home", new AjaxOptions{ HttpMethod="Post", InsertionMode=InsertionMode.Replace, UpdateTargetId="questionsdialog"}))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<table>
@for (var i = 0; i < Model.Count; i++)
{
<tr>
<td>
@Html.HiddenFor(x => x[i].questionID)
@Html.CheckBoxFor(x => x[i].IsChecked)
</td>
<td>
@Html.DisplayFor(x => x[i].question)
@Html.HiddenFor(x=> x[i].StudentId)
@Html.HiddenFor(x=> x[i].FormId)
</td>
</tr>
}
<tr>
<td><input type="submit" value="Submit" class="button search button" style="margin-right:10px"/></td>
</tr>
</table>
}
</div>
问题是,当我点击ActionLink时,它会打开带有问题的对话框,但如果我关闭对话框(不提交)并单击新的ActionLink,它会再次打开相同的旧问题(对话框)。对话框不会刷新一个新的actionlink电话。任何想法......在此先感谢