ASP.NET HtmlForm-component
Definitie en gebruik
Het HtmlForm-component wordt gebruikt om het <form>-element te beheersen. In HTML wordt het <form>-element gebruikt om formulieren te maken.
Note:Alle HTML-servercomponenten moeten zich binnen het HtmlForm-component bevinden!
Note:Within a single page, you can only use one HtmlForm control!
Properties
Properties | Description |
---|---|
Action |
URL, defines where the data is sent when the form is submitted. Note: This property is always set to the URL of the page itself! |
Attributes | Returns all attribute names and value pairs of the element. |
Disabled | Boolean value indicating 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 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. |
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 the control is a server control. It 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 | Boolean value indicating whether the control is visible. |
Example
- HTMLForm
- In this example, we have declared an HtmlInputText control, an HtmlInputButton control, and an HtmlGeneric control (remember to nest this control within an HtmlForm control). When the submit button is triggered, the submit subroutine is executed. This submit subroutine writes a welcome message to the p element.