I would like to create a static helper method that I can call from a view.
Is it possible for a helper method to have access to the current ViewContext without needing to explicitly pass the ViewContext to the method as a parameter?
Something like HttpContext.Current except for ViewContext.
public static class XTenshuns
{
public static string MyHtmlHelper(this HtmlHelper helper)
{
// it's right here -> helper.ViewContext
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With