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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:41:36+00:00 2026-05-13T22:41:36+00:00

In my aspx page I have a tr which is set visible=false by default.

  • 0

In my aspx page I have a tr which is set visible="false" by default. But on a selected index of a dropdown I make it visible="true". On the form submit I am validating the control within the tr but couldn’t find whether the tr is visible or not using JavaScript.

My aspx:

<tr id="MeasurementTr" runat="server" visible="false">
    <td>
        &nbsp;</td>
    <td class="table_label">
        Measurement</td>
    <td>
        &nbsp;</td>
    <td>
        <asp:DropDownList ID="DlMeasurement" runat="server">
        </asp:DropDownList>
    </td>
    <td>
        &nbsp;</td>
</tr>

and my JavaScript code,

 alert(document.getElementById("ctl00_ContentPlaceHolder1_MeasurementTr").style.visibility);
 if (document.getElementById("ctl00_ContentPlaceHolder1_MeasurementTr").style.visibility=="visible"){
     if (document.getElementById("ctl00_ContentPlaceHolder1_DlMeasurement").selectedIndex == 0) {
         document.getElementById("ctl00_ContentPlaceHolder1_ErrorMsg").innerHTML = "Please Select Your Measurement";
         document.getElementById("ctl00_ContentPlaceHolder1_DlMeasurement").focus();
         return false;
     }
 }

But my alert shows nothing. It didn’t show null or undefined.

  • 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-13T22:41:36+00:00Added an answer on May 13, 2026 at 10:41 pm

    The visible property of asp.net does not alter the CSS visibility property.. when it is true, asp.net will not render the element at all on the client side, so you cannot access it..

    Use a class with visibility:hidden display:none instead..

    [udpate]

    changed the suggestion to display:none after cheeso’s comment, since visibility:hidden will retain the space the element occupies, while the display:none takes no space in the rendered page.. it is, most likely, what you need …

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

Sidebar

Related Questions

I have dropdown list on my aspx page. I want to mannually set the
I have written a sample web service, which consist of certain .aspx pages. I
I have a directory and I want to allow users which are only logged
I have a master page that has two content sections like this (left some
Wondering if someone could help with with some Spring.net IOC integration into a .aspx
I know that in ASP.NET (talking about 2.0 here primarily) one can set a
I am at the moment trying to learn how to use basic grid view
Using the Microsoft.Samples.ReportingServices.ReportViewer, I am showing multiple instances of the same SRS report on
I'm using an asp:FileUpload control to give the user the chance to look for
I need to capture user's X.509 certificates from their cards and map to a

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.