ASP.NET HtmlFormControl


HTML Server ControlsHTML Server Controls

Definition and Usage

The HtmlForm control is used to control the <form> element. In HTML, the <form> element is used to create a form.

Note:All HTML server controls must be inside the HtmlForm control!

Note:You can only use one HtmlForm control in a page!


Attributes

Attribute Description
Action The URL defines where to send the data when the form is submitted.

Note:This attribute is always set to the URL of the page itself!

Attributes Returns all attribute names and value pairs of the element.
Disabled A Boolean value that indicates whether the control is disabled. Default is false.
EncType The MIME type used to encode the form content.
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 the text between the start and end tags of the HTML element. Special characters are automatically converted to HTML entities.
Method The way the form sends data to the server. Legal values are: "post" and "get". Default is "post".
Name The name of the form.
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.
Target The target window for loading the URL.
Visible A Boolean value that indicates whether the control is visible.


Examples

HTMLForm
In this example, we declare an HtmlInputText control, an HtmlInputButton control, and an HtmlGeneric control in a .aspx file (remember to nest the controls inside the HtmlForm control). When the submit button is triggered, the submit subroutine is executed. This submit subroutine writes a welcome message to the p element.


HTML Server ControlsHTML Server Controls Other Extensions