1

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

Community
  • 1
  • 1
Ropstah
  • 17,538
  • 24
  • 120
  • 194

1 Answers1

2

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

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

Chris Haas
  • 53,986
  • 12
  • 141
  • 274