MVC nested views and partial views

后端 未结 4 1822
死守一世寂寞
死守一世寂寞 2021-01-15 11:34

I am in the process of creating a prototype project using MVC 3 and I have come across a situation which I can\'t seem to find an answer for and it seems like I might be app

4条回答
  •  心在旅途
    2021-01-15 11:54

    Convert

    From

    @RenderBody()

    To

       

    From

    @Html.ActionLink("Contact", "List", "Contact")
    

    To

    @Ajax.ActionLink("Contact", "List", "Contact", new AjaxOptions { UpdateTargetId = "adminmain" })
    

    And in ContactController List action return PartialView() instead of 'View()'.

    Do not forget to include jquery.unobtrusive-ajax in your view to make Ajax work.

    And before all read Roman's Answer

提交回复
热议问题