Reference table cell

  • Thread starter Thread starter martin
  • Start date Start date
M

martin

Hi,

I have a webuser control.
The webuser control contains a single table webcontrol.

The start of the yable looks like

<asp:Table id="tblTabs" runat="server" BorderWidth="0" CellSpacing="0"
CellPadding="5">
<asp:TableRow>
<asp:TableCell ID="CellPracticePeople" CssClass="inactive">
<asp:LinkButton id="LnkBtnPracticePeople"
runat="server">Practice<br>People</asp:LinkButton>
</asp:TableCell>


I need to be able to reference the first table cell "CellPracticePeople" in
the code behind of my ascx page so that I can change the Cssclass of the
cell, however

CellPracticePeople.cssclass = "" gives and error

although the following works

tblTabs.Rows(0).Cells(0).CssClass = "active"

so my question is

How can I actually reference the table cell by its actual ID.

Many thanks in advance.

cheers

martin.
 
When dealing with Tables/Container controls, I've noticed the IDE is unable
to generate the field declarations.

Add this line of code in your codebehind beneath the Inherits line:
Protected WithEvents CellPracticePeople As
System.Web.UI.WebControls.TableCell
 
ok cheers,

I really should have noticed that myself.
Hopefully this will get fixed in the next release :)

cheers

martin.
 
Back
Top