ImageButton Control

ImageButton Control

Previous Home Next

 

The ImageButton Web server control is used to display images and responds to mouse clicks on the image. The class hierarchy for this control is as follows:

Object
 Control
  WebControl
    Image
     ImageButton

To set the Image for this control we use the ImageUrl property. Image buttons support both Click and Command events. When we handle Click events, we are passed the actual location of the mouse in the image. We can use Command event handlers to make the image button work like a command button.  

Properties:
1.CausesValidation::Specifies if a page is validated when an ImageButton control is clicked
2.CommandArgument::Additional information about the command to perform.
3.CommandName::The command associated with the Command event.
4.GenerateEmptyAlternateText::Specifies whether or not the control creates an empty string as an alternate text.
5.OnClientClick::The name of the function to be executed when the image is clicked.
6.PostBackUrl::The URL of the page to post to from the current page when the ImageButton control is clicked.

 
   

ImageUrl="~/logo.jpg" :Select Image from Source

PostBackUrl="http://r4r.co.in/" :The URL of the page to post to from the current page when the ImageButton control is clicked.

 ImageButton Design Code
************************************************************************
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="ImageButton.aspx.cs" Inherits="_Default" %>





    ImageButton


    
Previous Home Next