I have a custom helper method defined in a static class like so:
namespace MyProject.Helpers
{
public static class MyHelpers
{
public static MvcHtmlString TestData(this HtmlHelper helper, Guid controlId)
{
return MvcHtmlString.Create(string.Format("<div>Test Data: {0}</div>", controlId.ToString()));
}
}
}
I'd like to use this helper within another helper that is defined as a cshtml template like so:
@using System.Web.Mvc
@using MyProject.Helpers
@helper PanelHelper(ADOR.CMSWeb.Data.CMSControl control)
{
<div>
@Html.TestData(Guid.NewGuid())
</div>
}
This does not work. I don't have access to the Html helper from within the cshtml helper. I've tried using System.Web.Mvc.HtmlHelper, but my extension method isn't on that class.
Does anyone know how to access a static Helper from within a cshtml Helper to accomplish what I'm trying to do? It seems like it should be easy to do.
Thanks.