Using this stackoverflow thread, I created an extension for my HtmlHelper
How can I create a Html Helper like Html.BeginForm
My problem now is, I created a custom .cshtml
File with a Accordion
Function. Nothing special, just a custom Function so I can render stuff.
@helper Accordion(string text, HtmlHelper html)
{
<div class="accordion">
<div><h4>Das ist der Header</h4></div>
<div>
<p>Das ist der Content</p>
<p>@text</p>
@using(){
}
</div>
</div>
}
In this extra File, you can use the System HtmlHelper (via Html
), as well as an Helper you get from a parameter html
.
Now when I try to use my custom Extension ie in the Index View I can call
@using(Html.RoleContainer()){}
But in this extra render File, I can't call nor see Html.RoleContainer
or html.RoleContainer
.
How can I make the RoleContainer
available in the extra File so I can use it in my Accordion
Function?