2

As Im building sort of a window/tool setup in MVC4 Im wondering is it possible to do like a @Html.Partial("_PartialToolWindow") In a page including all the tools to be loaded. And then have this _PartialToolWindow load a defalut html template that should surround this code that the _PartialToolWindow contains?

For example...

<div class='boarder'>
     <div class='innerBorder'>
          --HERE IS THE SPECIFIC CONTENS--
     </div>
</div>

This _PartialToolWindow should have loaded this border and innerBorder to surrond its own HTML.

Jonas Lindahl
  • 752
  • 10
  • 24

1 Answers1

1

You can use a section in your layout.

_Layout.cshtml

<div class='boarder'>
     <div class='innerBorder'>
          @RenderSection("PartialToolWindow")
     </div>
</div>

Then you will be able to load specific content in your views:

@section PartialToolWindow
{
    <span>content</span>
}
Community
  • 1
  • 1
Ufuk Hacıoğulları
  • 37,978
  • 12
  • 114
  • 156