Skip Navigation LinksASP.Net 2.0 Training : ASP.Net ImageButton
Banner for ASP.Net 2.0 training classes in Visual Basic 2005 

Skip Navigation Links
ASP.Net 2.0 Training
VS File Management
ASP.Net Image
ASP.Net Checkbox
ASP.Net ImageButton
ASP.Net RadioButton
ASP.Net Literal
ASP.Net Panel
ASP.Net LinkButton
ASP.Net Calendar
ASP.Net BulletedList
ASP.Net FileUpload
ASP.Net User Controls
ASP.Net PlaceHolder
ASP.Net Lists
ASP.Net CheckBoxList
ASP.Net DropDownList
ASP.Net Data Access
ASP.Net DetailsView
ASP.Net FormView
ASP.Net Repeater Control
ASP.Net:Master Pages
Sending EMail
MultiView
Tabbed MultiView
ASP.Net:Wizard Control
Login Controls 1
ASP.Net:Site Navigation
ASP.Net:Classes
ASP.Net:SQLDataSource Control
ASP.Net:Error Handling
ASP.Net:dataTables
ASP.Net:datasets

Visit my other site:

Free Flash 8 tutorials and training

Free Dreamweaver Video Tutorials

Free PHP Training

Visual Basic Windows Training




If you like this site please link to it


ImageButton

  • The ImageButton control is used to display a clickable image.

Property

Description

CausesValidation

By default, a page is validated when a Button control is clicked. To prevent a page from being validated when clicking on a Button control, set this property to "false"

id

A unique id for the control

ImageUrl

The URL of the image to display

OnClick

The name of the function to be executed when the image is clicked

runat

Specifies that the control is a server control.  Must be set to "server"

  • Open Visual Studio
  • Add a new webform
  • Name it imageButton.aspx
  • Click the Add button
  • Select the Design View
  • Add an ImageButton control to the webform
  • Name it smallImage1
  • Repeat it 3 more times, naming it smallImage2, smallImage3, smallImage4
  • Add 4 images to your site
  • Select the ellipsis in the ImageURL property and select the image in each imageButton

  • Using the cursor change the size of the imageButtons down to a small button

  • Add an Image control and name it bigImage

  • Double click the imageButton and add this code:

bigImage.ImageUrl = sender.imageURL
We are going to use the same subroutine for each imagebutton
So instead of using smallimage1.imageURL we use the imageURL of the sending object. That way it does not matter which imageButton is clicked, that image will get put into the image control

  • Scroll down to the code for the first imageButton and you will see the following code added:

  • copy this code into each of the other imageButton controls

  • test it

Another feature you may want to add:

  • Select the image control
  • Change the height and width properties to 300 each

This will keep the image size steady



      ASP.Net 2.0 tutorials & training