1

我在网上阅读了几个使用以下代码的示例:

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---Localization.aspx
Asp.Net MVC:如何确定您当前是否在特定视图
http://groups。 google.com/group/spark-dev/browse_thread/thread/e5d9e8264c66ba57

4

1 回答 1

2

It looks like ViewName was removed during the betas. Here's two work-arounds:

http://forums.asp.net/p/1334617/2694729.aspx

于 2010-01-11T19:08:49.373 回答