Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ImageButton

An ImageButton control allows you to present a picture as a clickable control.

NoteNote

If you want to create an image with clickable regions, you can use the ImageMap.

When a user clicks an ImageButton, a form is submitted to the server. This causes the web page to be processed and any pending events to be raised in server-based code. For details about writing code for button controls, including ImageButton controls, see Button Web Server Controls Overview Cc295482.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

To add an ImageButton control to a page

  1. Drag the ImageButton control from the Toolbox panel to your page.

  2. Set properties that determine the appearance and behavior of the ImageButton in the Tag Properties panel.

Common ImageButton Properties

Property Description

ImageUrl

The path to the image that is displayed in the ImageButton control.

AlternateText

The text that is displayed when the image cannot be displayed.

For a full description of all ImageButton control properties, see ImageButton Properties Cc295482.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

NoteNote

The URL associated with an ImageButton control can be tampered with by a malicious user. For more information, see How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings Cc295482.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

When users click an ImageButton control, a parameter passed to the event handler for the control's Click event includes the coordinates indicating where the user clicked. This allows you to perform different tasks based on where the user clicked. Coordinate information is sent as part of the event-argument object for the Click event of the ImageButton control. For information on managing this coordinate information in code, see How to: Determine Coordinates in an ImageButton Web Server Control Cc295482.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2015 Microsoft