I have:
Page.aspx
Page.aspx.vb
TestClass.vb
I'm trying to access a shared property of the TestClass class from the Page.aspx.
This code works fine:
...
<head>
<script language="JavaScript">
<% if System.Globalization.CultureInfo.CurrentCulture.Name.ToLower = "pt-br" Then %>
alert('portugues');
<% else %>
alert('ingles');
<% end if %>
</script>
</head>
...
But when I try to access a shared property of TestClass, I get an exception:
<% if TestClass.Idioma = TestClass.TipoIdioma.Portugues Then %>
alert('portugues');
<% else %>
alert('ingles');
<% end if %>
ERROR BC30451: Name 'TestClass' is not defined.
This is the class:
Public Class TestClass
Public Enum TipoIdioma
Portugues
Ingles
End Enum
Public Shared ReadOnly Property Idioma() As TipoIdioma
Get
If System.Globalization.CultureInfo.CurrentCulture.Name.ToLower = "pt-br" Then
Return TipoIdioma.Portugues
Else
Return TipoIdioma.Ingles
End If
End Get
End Property
End Class