Render Partial View from other controller

后端 未结 5 1650
灰色年华
灰色年华 2020-12-13 05:52

Is there a way to render inside my view of controller A a partial view from other controller B?

Edit: I wrote a partial view that

5条回答
  •  盖世英雄少女心
    2020-12-13 06:10

    Just a side note as i found this thread searching for the same question but the answers weren't working: in Orchard CMS modules you cannot use the neat solution posted by Pittfall, you have to use relative paths to return partial views. Lets say you have a controller

    Controllers/SiteController.cs
    

    and you want to return the partial view

    Shared/MessageList/Items
    

    then in your action methods you need to write

    return PartialView("../Shared/MessageList/Items");
    

提交回复
热议问题