Dave Burke : Freelance .NET Web Developer specializing in Online Communities

id=listitem runat=server

I remember reading Wroxer Alex Homer over two years ago saying something to the effect “to make any html element a smart asp.net control, just add an ID=”XXX” and a RUNAT=SERVER tag.”  That stuck with me and here, two years later, I put it to use.

I wanted to hide a <li> line item based on a certain condition.  There is no system.web.ui.htmlcontrols.li class, so I added ID=liitem runat=server in the .ascx to see where it would lead.  In the codebehind I declared a generic control

protected System.Web.UI.HtmlControls.HtmlGenericControl liitem;

which gave me the ability to liitem.visible = false it.

Those asp.net designers.... They thought of everything.

 

Comments (0) | Post RSS RSS comment feed

Posted on 10/7/2003 6:50:00 PM by Dave Burke
Categories:
Tags:

Related posts


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke