|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
How to: Add Button Web Server Controls to a Web Forms Page
Web server controls make it easy for you to add different types of buttons to your Web Forms page. There are three types of button Web-server controls:, , and . For more information, see .
Adding an ImageButton control to a page is a little more involved than working with other button types. For details, see.
To add a button Web server control to a Web Forms page
<asp:LinkButton>element to the page. For syntax, see .
Set the caption by setting the control's Text property.
Defining an Access Key
To make it easier for users to click a button, you can define an access key for the button. Users can then simultaneously press the ALT key and the access key to click the button.
Access keys are not supported in all browsers.
To define the access key for a button
Set theproperty to a single letter or number. For example, to make the access-key combination ALT+B, specify B as the value of the AccessKey property.
In Windows applications, access keys are typically indicated on a button by an underlined character. This marking is not available for button Web server controls due to restrictions in HTML. If you want to be able to display the access key for a button, you can use thecontrol.