MVC nested views and partial views

后端 未结 4 1866
死守一世寂寞
死守一世寂寞 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条回答
  •  猫巷女王i
    2021-01-15 11:39

    I came across something interesting when working with nested partial views in MVC4. Just in case somebody stumbles upon this..

    When rendering a partial view in a loop,

    @Html.Partial()
    

    does not work.

    Instead, use @Html.RenderPartial(); that emits the HTML instead of HTML encoded in the former case and works.

    Cheers!

提交回复
热议问题