|
-
Jul 11th, 2004, 03:29 AM
#1
How to - DataList, FindControl, HTMLTableCell [Resolved]
My WebControls.DataList contains an HTML Table (5 rows, 3 cols) with either an ASP Label, Image or HyperLink in the cell. Using this FindControl code in the DataList_ItemDataBound event , I can modify the properties of these controls no problem.
Code:
Dim CompanyLink As HyperLink = CType(e.Item.FindControl("hlnkCompanyName"), HyperLink)
CompanyLink.Text = oData("CompanyName")
But I am trying to set the Background property of a specific cell depending on the contents of a field. However, I can't seem to "find" the HTMLTableCell that I need to modify using
Code:
Dim LinksCell As HtmlTableCell = CType(e.Item.FindControl("tdLinksCell"), HtmlTableCell)
The LinksCell variable is always nothing. Anyone know how this works?
Last edited by brucevde; Jul 11th, 2004 at 11:45 AM.
-
Jul 11th, 2004, 11:45 AM
#2
If anyone is interested..
I needed to include the runat=server in the specific <td> tags.
Also, to modify the Background property of a HTMLTableCell at runtime, I used this code
LinksCell.Attributes.Add("background", "images/silver2.gif")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|