Image Control in ASP.
NET
Ideally Image control is used to place an image on the page. When it is rendered on the page, it is
implemented through <img /> HTML tag.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height
etc. are implemented through style properites of <img>.
Following are some important properties that are very useful.
ImageUrl Url of image location.
AlternetText Appears if image not loaded properly or if image is missing in the specified
location.
Tooltip Text message Appearing on mouse over the image
ImageAlign Used to align the Text beside image.
Image Button
The ImageButton control is used to display a clickable image.
ImageButton control is generally used to post the form or fire an event either client side or server
side. When it is rendered on the page, generally it is implemented through <input type=image >
HTML tag.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height
etc. are implemented through style properites of <input> tag. You can set its Image location
either by setting ImageURL properties in the .aspx page or from server side page. (other
properties can also be set from both pages)
Following are some important properties that are very useful.
ImageUrl Gets or Sets the location of the image to display.
CausesValidation Value can be set as true/false. This indicates whether validation should be
performed when a button is clicked.
PostBackUrl Indicates the URL on which the Form will be posted back.
ValidationGroup Gets or Sets the name of the validation group that the button belongs to. This
is used to validate only a set of Form controls with a Button.
ImageMap Control
ImageMap control is used to create an image that contains clickable hotspot region. When user
click on the region, the user is either sent to a URL or a sub program is called. When it is
rendered on the page, it is implemented through <img /> HTML tag.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height
etc. are implemented through style properites of <img>.
Following are some important properties that are very useful.
ImageUrl Url of image location.
AlternetText Appears if image not loaded properly
Tooltip Appears when on mouse over the image
ImageAlign Used to align the Text beside image.
HotSpotMode PostBack/Navigate .... When Navigate, the user is navigated to a different URL.
In case of PostBack, the page is posted back to the server.
OnClick Attach a server side event that fires after clicking on image when
HostSpotMode is PostBack.
PostBackValue You can access it in the server side click event through ImageMapEventArgs.
(eg. e.PostBackValue)