ASP.NET HtmlGeneric Control
HTML Server Controls
Definition and Usage
The HtmlGeneric control is used to control other HTML elements not specified by a specific HTML server control, such as
、 、 、
and so on.
property
| property | Description |
|---|---|
| Attributes | Returns all attribute name and value pairs of the element. |
| Disabled | A Boolean value that indicates whether the control is disabled. The default is false. |
| id | The unique id of the control. |
| InnerHtml | Sets or returns the content between the opening and closing tags of this HTML element. Special characters are not automatically converted to HTML entities. |
| InnerText | Sets or returns all text between the opening and closing tags of this HTML element. Special characters are automatically converted to HTML entities. |
| runat | Specifies that this control is a server control. Must be set to "server". |
| Style | Sets or returns the CSS properties applied to this control. |
| TagName | Returns the tag name of the element. |
| Visible | A Boolean value that indicates whether the control is visible. |
Example
HTMLGeneric
In this example, we declare an HtmlInputText control, an HtmlInputButton control, and an HtmlGeneric control (
tag) (remember to nest the controls inside the 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