VB.net Tutorials with Examples

VB.Net Projects

VB.Net Project 1

Image Button in ASP.NET
Previous Home Next

ImageButton control is used to display an image that responds to mouse clicks. Specify the image to display in the control by setting the ImageUrl property.Both the Click and Command events are raised when the ImageButton control is clicked.

By using the OnClick event handler, you can programmatically determine the coordinates where the image is clicked. You can then code a response based on the values of the coordinates. Note the origin (0, 0) is located at the upper-left corner of the image.

You can use the OnCommand event handler to make the ImageButton control behave like a command button. A command name can be associated with the control by using the CommandName property. This allows multiple ImageButton controls to be placed on the same Web page.

The value of the CommandName property can then be programmatically identified in the OnCommand event handler to determine the appropriate action to perform when each ImageButton control is clicked. The CommandArgument property can also be used to pass additional information about the command, such as specifying ascending order.

 

Property

Property Description
CausesValidation Specifies if a page is validated when an ImageButton control is clicked
CommandArgument Additional information about the command to perform
CommandName The command associated with the Command event
GenerateEmptyAlternateText Specifies whether or not the control creates an empty string as an alternate text
OnClientClick The name of the function to be executed when the image is clicked
PostBackUrl The URL of the page to post to from the current page when the ImageButton control is clicked
ValidationGroup Specifies that the control is a server control.  Must be set to "server"
runat The group of controls for which the ImageButton control causes validation when it posts back to the server

How to Set  Image On Button

Output

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: