Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ASP.NET HtmlForm Control

ASP.NET HtmlForm Control


HTML Server Controls HTML Server Controls


Definition and Usage

The HtmlForm control is used to control the

element. In HTML, the element is used to create a form.

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

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


property

property Description
Action The URL that defines where the data is sent when the form is submitted.

Note:This property is always set to the page's own URL!

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.
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 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.
Method The method by which the form sends data to the server. Valid values are: "post" and "get". The default is "post".
Name The name of the form.
runat Specifies that this 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 that loads the URL.
Visible A Boolean value that indicates whether the control is visible.

Example

HTMLForm
In this example, we declare an HtmlInputText control, an HtmlInputButton control, and an HtmlGeneric control in the .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 Controls HTML Server Controls