Using html helpers in Razor web helper
asp.net-mvc, razor
Solution
You can cast the static Page property from the context to the correct type:
@helper MyHelper() {
var Html = ((System.Web.Mvc.WebViewPage)WebPageContext.Current.Page).Html;
Html.RenderPartial("WhatEver");
@Html.EditorForModel();
}
Problem
I am trying to create a Razor web helper something like this : ``` @helper DisplayForm() { @Html.EditorForModel(); } ``` But this gives the error `"CS0103: The name 'Html' does not exist in the current context"`. Is there any way to reference html helpers within web helpers?