0

In Asp.Net Mvc when you Render view in a layout that defines some Sections, all Sections in view placed in proper Sections as you defined in layout file,

consider a situation when you want to RenderPartial a view (which have some Sections) in another view, but all the code which you placed in Section of child view does not render in parent view (because the parent view does not necessarily have the defined Sections) so only parts of view that does not placed in any Section are rendered,

Now my question: is it possible to render specific Section of view with methods RenderPartial or RenderAction ?

Giscard Biamby
  • 4,569
  • 1
  • 22
  • 24
mc.parsa
  • 56
  • 1
  • 6

1 Answers1

-1

You can put you code in separate view. And you will be able to render this part with RenderPartial. If you create action in controll you will ba able to use RenderAction .

But in your code you can define section like

@section MySection{
   @Html.RenderPartial(/*bla bla*/)
    }
Anton Baksheiev
  • 2,211
  • 2
  • 14
  • 15