开发者

ASP.Net MVC Ajax RenderPartial not rendering correctly

I have an AJAX form which returns a partial view, but instead of the target div getting updated, when I submit, only the partial view is shown. As far as I can tell, I have everything set up the way it's supposed to be, what's going wrong?

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewU开发者_Go百科serControl<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)%>


<% } %>

and in the controller:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜