ASP.NET HtmlGenericControl
HTML Server Controls
Definition and Usage
The HtmlGeneric control is used to control other HTML elements not specified by specific HTML server controls, such as <body>, <div>, <span>, <font>, <p>, etc.
Attributes
| Attribute | Description |
|---|---|
| Attributes | Returns all attribute name and value pairs for the element. |
| Disabled | Boolean value indicating whether the control is disabled. Default is false. |
| id | The unique id of the control. |
| InnerHtml | Sets or returns the content between the start and end tags of the HTML element. Special characters are not automatically converted to HTML entities. |
| InnerText | Sets or returns all text between the start and end tags of the HTML element. Special characters are automatically converted to HTML entities. |
| runat | Specifies that the control is a server control. Must be set to "server". |
| Style | Sets or returns the CSS properties applied to the control. |
| TagName | Returns the tag name of the element. |
| Visible | Boolean value indicating whether the control is visible. |
Example
HTMLGeneric
In this example, we declare an HtmlInputText control, an HtmlInputButton control, and an HtmlGeneric control (a <p> tag) in an .aspx file (remember to nest the controls inside an HtmlForm control). When the submit button is triggered, the submit subroutine is executed. The submit subroutine writes a welcome message to the p element.
HTML Server Controls Other Extensions