2
我有以下ajax.actionlink: -如何更新使用Ajax.beginform我的asp.net MVC Web應用程序內的兩個DOM元素
<div id ="link">
@Ajax.ActionLink("Add New Answer", "Create", "Answer",
new { questionid = Model.QuestionID },
new AjaxOptions
{
HttpMethod = "Get",
UpdateTargetId = "link",
InsertionMode = InsertionMode.InsertAfter,
LoadingElementId = "progress"
})
</div>
在上面的鏈接將retrun _answer局部視圖以下哪包含Ajax.Actionlink: -
@using (Ajax.BeginForm("Create", "Answer", new AjaxOptions
{
HttpMethod = "Post",
InsertionMode = InsertionMode.InsertAfter,
UpdateTargetId = "incrementanswer",
}))
{
<div id = "returnedquestion">
@Html.ValidationSummary(true)
<fieldset>
<legend>Answer here</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Description)
@Html.ValidationMessageFor(model => model.Description)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.IsRight)
</div>
<div class="editor-field">
@Html.DropDownList("IsRight", String.Empty)
@Html.ValidationMessageFor(model => model.IsRight)
</div>
</fieldset>
<input type= "hidden" name = "questionid" value = @ViewBag.questionid>
<input type= "hidden" name = "assessmentid" value = @ViewBag.assessmentid>
<input type="submit" value="Add answer" />
</div>
}
</div>
目前點擊提交按鈕,在「UpdateTargetId =‘incrementanswer’後,將與submition的結果進行更新,但問題是,我還需要刪除當前_answer部分視圖