ASP.NET Button control
Definition and Usage
Button control is used to display the push button. Push button may be a submit button or a command button. By default, this control is a submit button.
Submit button does not have a command name, it is clicked it will page back to the server. Write an event handler to control the actions submit button is clicked executed.
Command button has a command name and allows you to create multiple Button controls on a page. Write an event handler to control the operation of the command button is clicked to perform.
Attributes
属性 | 描述 | .NET |
---|---|---|
CausesValidation | 规定当 Button 被点击时是否验证页面。 | 1.0 |
CommandArgument | 规定有关要执行的命令的附加信息。 | 1.0 |
CommandName | 规定与 Command 事件相关的命令。 | 1.0 |
OnClientClick | 规定当按钮被点击时被执行的函数的名称。 | 2.0 |
PostBackUrl | 规定当 Button 控件被点击时从当前页面传送数据的目标页面 URL。 | 2.0 |
runat | 规定该控件是服务器控件。必须设置为 "server"。 | 1.0 |
Text | 规定按钮上的文本。 | 1.0 |
UseSubmitBehavior | 一个值,该值规定按钮使用浏览器的提交机制,还是使用 ASP.NET 的 postback 机制。 | 2.0 |
ValidationGroup | 规定当按钮回传服务器时,该按钮所属的那个控件组引发了验证。 | 2.0 |
Web Control Standard Properties
For a full description, visit the Web Control Standard Attributes .
Control Standard Properties
For a full description, go to Control Standard Attributes .
Try - Example
Button
In this case, we have declared in the .aspx file a submit Button control. Then we create an event handler to change the text on the button when the Click event occurs.
Button 2
In this case, we have declared in the .aspx file a submit Button control. Then we create an event handler for the Click event of the button to change the text and style.
Web server control