[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How do I access the HTMLTableRowCollection ?

Posted on 2004-11-18
Medium Priority
Last Modified: 2012-06-21
How do I access the HTMLTableRowCollection when in the code behind of an ASP page ?

I have the page as :

<TABLE id="tbl1" cellSpacing="0" cellPadding="0" align="center" border="0">
    <TR id="tr1" align="left">
        <TD align="left">
            <asp:TextBox id="Textbox1" tabIndex="24" runat="server" Columns="32" MaxLength="20"></asp:TextBox>

In the code :

protected System.Web.UI.HtmlControls.HtmlTableRow tr1;

this.tr1.Visible = true;

But the tr1 object is not set to an instance of the object.

I can see that tr1 is undefined but how to a set it to the instance on the page ?

Question by:Paul__M

Accepted Solution

tstoeckigt earned 1000 total points
ID: 12614825
You probably have to set them as 'runat=server' to view them in your CodeBehind-Class.
The aspx derives the codebehind-class not otherwise so you have to declare it this way and your IDE will declare it also in the codebehind-class (if not you can do it yourself).
With an tag declared as runat=server this object is recognized as derived from the underlying codebehind-class (or some parent of it).


Author Comment

ID: 12614858
Just realised that myself - thanks.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question