ASP.Net MVC Ajax RenderPartial无法正确呈现

时间:2010-01-22 23:47:18

标签: asp.net-mvc asp.net-ajax

我有一个AJAX表单,它返回一个局部视图,但是当我提交时,而不是更新目标div,只显示部分视图。据我所知,我已经按照预期的方式设置了一切,出了什么问题?

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ApplianceSurvey.Models.Item>" %>
<% using (Ajax.BeginForm("AddSurveysAJAX",
     new AjaxOptions { UpdateTargetId = "SurveyListContent", InsertionMode = InsertionMode.Replace }))
   { %>
      <%= Html.Hidden("itemID", Model == null ? ViewData["itemID"] : Model.ItemID) %>
      <%= Html.ListBox("SurveysLst", ViewData["Surveys"] as MultiSelectList)%>

      <input type="submit" value=">>>" />

      <%= Html.ListBox("SelSurveysLst", ViewData["ItemSurveys"] as MultiSelectList)%>


<% } %>

并在控制器中:

[AcceptVerbs(HttpVerbs.Post)]
    public PartialViewResult AddSurveysAJAX(FormCollection formValues)
    {
      //do stuff          
      return PartialView("ItemSurveys");
    }

0 个答案:

没有答案