Jaa


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: Button, LinkButton, and ImageButton. For more information, see Button Web Server Controls Overview.

Adding an ImageButton control to a page is a little more involved than working with other button types. For details, see How to: Add ImageButton Web Server Controls to a Web Forms Page.

To add a button Web server control to a Web Forms page

  1. From the Standard tab of the Toolbox, drag a Button or LinkButton control onto the page.

  2. In the Appearance category of the Properties window, specify the button label 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.

Note

Access keys are not supported in all browsers.

To define the access key for a button

  • In the Accessibility category of the Properties window, set the button control's AccessKey property 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.

    Note

    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 the HtmlButton control.

See Also

Tasks

How to: Respond to Button Web Server Control Events

Other Resources

Setting ASP.NET Server Control Properties Programmatically