Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With Razor is it possible to include a View in a View?

Tags:

razor

Te be sure to understand I would like to know if with Razor is it possible to include a View in a View? If yes, how?

like image 666
Bastien Vandamme Avatar asked Jun 21 '12 09:06

Bastien Vandamme


1 Answers

Typically it's done with some overload of the HtmlHelper.RenderPartial extension method, for example:

@{ Html.RenderPartial("ViewName"); }

There are also other methods that can be used according to the situation, such as Partial (render view to a string):

@Html.Partial("ViewName")

There's also RenderAction (render view as specified by controller action).

like image 116
Jon Avatar answered Sep 28 '22 10:09

Jon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!