Latest web development tutorials

ASP.NET HtmlForm Controls

HTML Server Controls HTML server controls

Definition and Usage

HtmlForm control for controlling the <form> element. In HTML, <form> element is used to create the form.

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

Note: Within a page, you can only use a HtmlForm control!


Attributes

属性 描述
Action URL 定义当表单提交时把数据送往何处。

注释:该属性总是设置为页面自身的 URL!

Attributes 返回该元素的所有属性名称和值对。
Disabled 布尔值,指示是否禁用该控件。默认是 false。
EncType 用来编码表单内容的 MIME 类型。
id 控件的唯一 id。
InnerHtml 设置或返回该 HTML 元素的开始标签和结束标签之间的内容。 特殊字符不会被自动转换为 HTML 实体。
InnerText 设置或返回该 HTML 元素的开始标签和结束标签之间的所有文本。 特殊字符会被自动转换为 HTML 实体。
Method 表单向服务器传送数据的方式。合法值有: "post" 和 "get"。默认是 "post"。
Name 表单的名称。
runat 规定该控件是一个服务器控件。必须被设置为 "server"。
Style 设置或返回被应用到控件的 CSS 属性。
TagName 返回元素的标签名。
Target 加载 URL 的目标窗口。
Visible 布尔值,指示该控件是否可见。


Examples

HTMLForm
In the present case, we declare a HtmlInputText control in an .aspx file, a HtmlInputButton control, and one HtmlGeneric control (remember to control nested HtmlForm control). When the submit button is triggered, the submit subroutine is executed. The submit subroutine will write to the p elements of a welcome message.


HTML Server Controls HTML server controls