为什么 ViewContext.ViewName 不可用?
我在网上读到了几个使用以下代码的示例:
Private Function SomeFunction(ByVal htmlhelper As HtmlHelper) As String
Dim controller As Controller = htmlhelper.ViewContext.Controller
If controller IsNot Nothing Then
Dim vname as String = htmlhelper.ViewContext.ViewName 'This doesnt work
End If
End Function
ViewContext 没有名为 ViewName 的成员。我错过了什么吗?
参考文献: http://blog.eworldui.net/post/ 2008/05/ASPNET-MVC---本地化.aspx
Asp.Net MVC:如何确定您当前是否处于特定视图
http://groups.google.com/group/spark-dev/ browser_thread/thread/e5d9e8264c66ba57
I read several examples on the web which use the following code:
Private Function SomeFunction(ByVal htmlhelper As HtmlHelper) As String
Dim controller As Controller = htmlhelper.ViewContext.Controller
If controller IsNot Nothing Then
Dim vname as String = htmlhelper.ViewContext.ViewName 'This doesnt work
End If
End Function
ViewContext does not have a member called ViewName. Am I missing something?
Refs:
http://blog.eworldui.net/post/2008/05/ASPNET-MVC---Localization.aspx
Asp.Net MVC: How to determine if you're currently on a specific view
http://groups.google.com/group/spark-dev/browse_thread/thread/e5d9e8264c66ba57
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来
ViewName
在测试期间已被删除。这里有两个解决方法:http://forums.asp.net/p/1334617/ 2694729.aspx
It looks like
ViewName
was removed during the betas. Here's two work-arounds:http://forums.asp.net/p/1334617/2694729.aspx