Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:29:42+00:00 2026-05-13T11:29:42+00:00

I have: Page.aspx Page.aspx.vb TestClass.vb I’m trying to access a shared property of the

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:29:43+00:00Added an answer on May 13, 2026 at 11:29 am

    You need to create a new instance of TestClass. Try something like this:

    <script language="JavaScript">
    
        <%
        Dim tc = new TestClass()
        if TestClass.Idioma = TestClass.TipoIdioma.Portugues Then %>
            alert('portugues');
        <% else %>
            alert('ingles');
        <% end if %>
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page (default.aspx) with a Repeater fetching data from my database, this
I have a page www.senderdomain.com/sender.aspx , from which i need to write a string
I have an aspx page that used a method in a class in the
I have a page with name Default.aspx, on Default.aspx I have Property protected string
I have aspx page where there is no code behind. Server side Code written
I have page A.aspx in my domain this page (in its c# codes) makes
Let's say I have a page Test.aspx along with test.aspx.vb. Test.aspx.vb contains a class
I have a page (myPage.aspx) that contains a number of divs. EG. <div class=quote>something
I have page (Default1.aspx) in which I am redirecting to another page (Default2.aspx) using
I have a web page (.aspx) that calls a third party web service to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.