2
利用這個計算器線程,現在我創建了一個擴展我的HtmlHelperasp.net MVC4的HtmlHelper擴展和渲染功能
How can I create a Html Helper like Html.BeginForm
我的問題是,我創建了一個自定義的.cshtml
文件與Accordion
功能。沒什麼特別的,只是一個自定義函數,所以我可以渲染的東西
@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>
}
在這種額外的文件,你可以使用系統的HtmlHelper(通過Html
),以及您從參數html
得到一個助手。
現在,當我嘗試使用IE瀏覽器的索引視圖我的自定義擴展我可以叫
@using(Html.RoleContainer()){}
但在這額外的渲染文件,我不能叫,也沒有看到Html.RoleContainer
或html.RoleContainer
。
如何使RoleContainer
在額外的文件中可用,以便我可以在我的Accordion
函數中使用它?