Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditionally hide a cell (<TD>) on asp page 1

Status
Not open for further replies.

skitty123

Technical User
May 4, 2004
56
US
I have some a series of Hyperlinks on a page
<TD class="cssfile" id="link1" noWrap><A class= class="cssfile" href="~/Home/default.aspx" runat="server">Home</A></TD>
.. etc
I want to hide some of the links on page_load depending on some criteria stored in a database. so I am trying to hide teh entire cell that holds this Hyperlink tag.

How do I reference a certain cell (named link1, link2 link3 etc)in my code behind file?

I tried using thier id but I get "Object reference not set to an instance of an object."

Alternatively, is there a way to use a style sheet Asp:hyperlinks ?
 
To control a HtmlTableCell in code you need to give it the runat=server attirbute.

Yes, use a HyperLink control, instead of a regular <a> tag - You can set it's Visibility property to show or hide it, as well as apply CssClass property.

Greetings,
Dragonwell
 
Thanks! I already had the runat erver for my <A> tag but was missing it for my <TD> tag. it works perfectly now
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top