Name

HtmlControl

Synopsis

This is the base class for all HTML server controls. It includes basic functionality—like the Disabled property, which you can use to make a control read-only, and the TagName property, which identifies the HTML tag that underlies this control (for example, “div” or “a”).

Additionally, you can set and retrieve various other properties through the weakly typed Attributes collection, which contains a name/value collection of all the attributes applied to a tag. You can add a new attribute by assigning to it, as in MyText.Attributes("onblur")="javascript:alert('Focus lost!');". This statement, which adds a client-side JavaScript event through an attribute, is the equivalent of using the tag <input type="text" id="MyText" onblur="javascript:alert('Focus lost!');" runat="server"/>. Some attributes may be provided as properties in the derived class. Another dictionary collection, Style, allows you to specify CSS properties for a tag (as in MyText.Style("width") = "120px").

Public MustInherit Class HtmlControl : Inherits System.Web.UI.Control : Implements_
        System.Web.UI.IAttributeAccessor
' Public Constructors
   Public Sub New() 
   Public Sub New(ByVal tag As String) 
' Public Instance Properties
   Public ReadOnly Property Attributes As AttributeCollection  
   Public Property Disabled As Boolean  
   Public ReadOnly Property Style As CssStyleCollection  
   Overridable Public ReadOnly Property TagName As String  
' Protected Instance Properties
   Overrides Protected Property ViewStateIgnoresCase ...

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.