Findcontrol problem

  • Thread starter Thread starter Arjen
  • Start date Start date
A

Arjen

Hi,

I have this inside my asp.net 2.0 page:

Page start code...

<asp:Content ID="content" ContentPlaceHolderID="content1" Runat="Server">
<table>
<tr>
<td id="mytd" runat="server">

... page end code.

How can I get mytd?

I tried this Page.FindControl("mytd") but this did not work. ;-(

Hope someone can help.
 
The FindControl Method works only on the Controls that are immediately
inside the Control Specified. Example:

HtmlTableCell myTd = content1.FindControl("myTd");

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
I tried this Page.FindControl("mytd") but this did not work. ;-(

Kevin gave you the correct answer. I have an article that expands on
the "why" part:

In Search Of ASP.NET Controls
http://odetocode.com/Articles/116.aspx

You are using master pages, and master pages are marked with the
INamingContainer interface. The article explains the impact of
INamingContainer on FindControl.

HTH,
 
Back
Top