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 6183735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:25:01+00:00 2026-05-24T01:25:01+00:00

I have a boolean property in code-behind ASP.NET, now I want to use it

  • 0

I have a boolean property in code-behind ASP.NET, now I want to use it in Javascript of mark-up file, but Javascript do not understand True, or False. SO now, I’m using this:

if ( '<%=IsTabVisible%>' == 'True'){
///
}

It works, but quite ugly. Is there a better way to do this?

Thank you

  • 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-24T01:25:02+00:00Added an answer on May 24, 2026 at 1:25 am

    The way I see it you have three options:

    A. Do what you are already doing.

    B. Perform the if test on the server-side, something like this:

    <% if (IsTabVisible) { %>
        // client-side code here, whatever you had inside the brackets
        // of your original if statement
    <% } %>
    

    C. Make sure you generate ‘true’ and ‘false’ in lowercase so that it will work as client-side JavaScript, something like this:

    if (<%= IsTabVisible ? "true" : "false" %>)

    Which will appear to the client as:

    if (true)
    

    or

    if (false)
    

    Option A may look a bit funny but it works fine. Option C produces pretty client-side code that probably nobody will see. My preference is Option B.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class isSearching with a single boolean property in a 'functions' file
I have the code that change the state of boolean property on mouseclick, depending
The case goes as following: You have a Boolean property called FullScreenEnabled. You enter
I have a custom object Foo with a boolean property called Flagged and when
I have an class which has a enum property and a boolean property, based
I have CustomForm inherited from Form which implements a boolean property named Prop .
I have a generic collection of type MyImageClass, and MyImageClass has an boolean property
On my Core Data Entity Book i have a boolean property, 'wasViewed' (NSNumber numberWithBool)
I have a model which has a boolean property and some other properties that
I have a set of model objects that have a public IsVisible boolean property.

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.