Image Buttons And Image Controls

The Image control is used to display an image.

Property Description .NET
AlternateText An alternate text for the image 1.0
DescriptionUrl The location to a detailed description for the image 2.0
GenerateEmptyAlternateText Specifies whether or not the control creates an empty string as an alternate text 2.0
ImageAlign Specifies the alignment of the image 1.0
ImageUrl The URL of the image to display for the link 1.0
runat Specifies that the control is a server control.  Must be set to "server"


Example
 
<body>
<form runat="server">
<asp:Image id="Img1" runat="server"
ImageUrl
="img_w3link.gif" ImageAlign="Right"/>
</form>
</body>


The ImageButton control is a Button control that displays an image instead of text 

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

Example:



<asp:ImageButton ID="ImageButton1" runat="server" Height="81px" ImageUrl="~/samsung.jpg" OnClick="ImageButton1_Click" Width="189px" />


protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Label1.Text = “HAi…..”;
    }
 

No comments:

Post a Comment