partial view rendering
I have a partial view in my Foo folder. I want to show it on m开发者_JAVA技巧y Home/index view. I am using partial render and it is trying to locate it in temp folder. How to write Renderpartial to render foo\partial view ?
regards, Asif hameed
To get it to render just specify the path in RenderPartial like this:
<%Html.RenderPartial("~/Areas/FooArea/Views/Foo.ascx");%>
Obviously replace my example path with the path to your actual Foo partial view.
If you want to call an action that returns a partial view on another controller (foo) try using Html.RenderAction. It will allow you to pass in an action and a controller.
This post has a decent description of the differences between RenderPartial/RenderAction and when to use each one: http://www.arrangeactassert.com/when-to-use-html-renderpartial-and-html-renderaction-in-asp-net-mvc-razor-views/
精彩评论