INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Hiding a HTML table in code

Hiding a HTML table in code

(OP)
I am working on an ASP web page that contains a HTML table with an id value. In the code behind file I want to toggle the visibility of the table but am not able to find a reference to it in intellisense. Here's a partial extract from the aspx file:

CODE

<table id="tblRegInfo" style="font-size:100%;height:36px; width:820px;" >
    <tr>
        <td align="right" class="style18">
          <asp:Label ID="UserNameLabel" runat="server">Logon Name:</asp:Label>
        </td>
        <td>
            <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" 
                ControlToValidate="txtUserName" ErrorMessage="User Name is required." 
                ToolTip="User Name is required." ForeColor="Red">*</asp:RequiredFieldValidator>
        </td>
    </tr>
    // Lots of additional rows with data elements in them.
</table> 

Code in the .cs file has no trouble referencing the labels or text boxes. Why am I unable to reference the "tblRegInfo" object? Must my table be of the asp:Table type in order for me to reference it in the C# file?

Steve

RE: Hiding a HTML table in code

The <table> you defined is just an HTML table.
To reference it in your code-behind, add the attribute runat="server" to the <table> tag.

RE: Hiding a HTML table in code

(OP)
That's what I needed...thanks!

RE: Hiding a HTML table in code

sure, and time

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close