getting reference to HtmlTableCell

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hi

asp.net 2.0

I'm having problem getting reference to a HtmlTableCell, below you see my
code. the cell value get a null value...

using System.Web.UI.HtmlControls;
HtmlTableCell cell = (HtmlTableCell)FindControl("lblRole");

<td style="width:140px; text-align:right;" id="lblRole">Role:</td>

any suggestions?
 
I see the id but no runat="server" attribute.

I also suggest turning on Trace and reading the control tree hierarchy as
each part of the hierarchy is then submitted as an argument to a chained
instance of FindControl

// example
FindControl("...").FindControl("...") etc.

Depending on circumstances its much easier to find and code. I'd even try
the following instead...
<td style="width:140px; text-align:right;">
<asp:Label id="RoleLabel" Text="" runat="server" />
</td>
 
Back
Top