Button Web Server Controls Content Map
Use the ASP.NET button Web server controls to enable users to post a page to the server. The button controls trigger an event in server code that you can handle to respond to the postback. For example, a user can indicate that they have completed a form or that they want to perform a specific command. The Button control can also raise an event in client script that you can handle before the page is posted or that can run and then cancel submission of the page.
ASP.NET includes several kinds of button controls, each of which appears differently on Web pages, as listed in the following table:
Presents a standard command button, which is rendered as an HTML input element.
Renders as a hyperlink in the page. However, it contains client-side script that causes the form to be posted back to the server. (You can create a true hyperlink by using the HyperLink Web server control.)
Renders a graphic as a button. This is useful for presenting a rich button appearance. The ImageButton control also provides information about the coordinates within the graphic where has clicked.
HTML button elements that you can program as ASP.NET Web server controls.
For information about the differences between HTML and Web server controls, see ASP.NET Web Server Controls Overview.
Lets you create a graphic that has hotspots that users can click to perform a postback or other action.
The ImageMap control lets you create a graphic that has hotspots that users can click in order to post a page or to perform other actions.
The following table lists tasks that are often performed using ASP.NET Web server button controls.
Respond to a button event.
Create a handler in server code for the button's Click event or Command event.
Determine which button among several caused the postback.
Run client script after a button is clicked and before the page is posted (for example, to display a confirmation message).
Determine the coordinates in an image button where a user clicked.
In response to a button click, post to a different page than the one that the button is on.
Set the button's PostBackUrl property. For more information, see Redirecting Users to Another Page.
Specify whether a button click causes user input to be validated.
Enable or disable the button's CausesValidation property.
Determine which controls on the page perform validation in response to a button click.
Set the button's ValidationGroup property to match the name that is used with a validation control.
Configure a button to cause a partial-page postback.
Include the button inside an UpdatePanel control or put it outside the UpdatePanel control and set it to be a trigger. For more information, see UpdatePanel Control Overview and Partial-Page Rendering Overview.