getting reference to HtmlTableCell

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?
 
H

Hillbilly

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,160
Messages
2,570,890
Members
47,423
Latest member
henerygril

Latest Threads

Top