Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding a HTML table in code

Status
Not open for further replies.

SGLong

Programmer
Jun 6, 2000
405
US
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

 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top