Kei*_*ith 5 asp.net asp.net-mvc viewcontext
我想创建一个静态帮助方法,我可以从视图中调用.
辅助方法是否可以访问当前的ViewContext而无需将ViewContext作为参数显式传递给方法?
类似于HttpContext.Current,除了ViewContext.
public static class XTenshuns
{
public static string MyHtmlHelper(this HtmlHelper helper)
{
// it's right here -> helper.ViewContext
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4337 次 |
| 最近记录: |