ASP.NET HtmlButton Control

Definition and Usage

The HtmlButton control is used to control the <button> element. In HTML, the <button> element is used to create buttons.

Properties

Properties Description
Attributes Returns all attribute names and value pairs of the element.
Disabled Boolean value indicating whether the control is disabled. The default is false.
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.

OnServerClick The name of the function to be executed when the button is clicked.
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.
Visible Boolean value indicating whether the control is visible.

Example

HTMLButton
In this example, we declare two HtmlButton controls (remember to nest this control within an HtmlForm control). Then, we write an event handler to specify the action to be executed when the button is clicked.