Home > DeveloperSection > Beginner > ImageButton in ASP.Net

ImageButton in ASP.Net


ASP.Net ASP.Net 
Ratings:
0 Comment(s)
 4101  View(s)
Rate this:

ImageButton Control in ASP.Net

The ImageButton control is used to display a clickable image. And has the same functionality as a Button control.

<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/asp-net.jpg"Width="91px"/>

ImageButton Control in ASP.Net

 

It has same event as in Button but having different properties

Properties

Property

Description

Image url

The url of the image

When you click on a imagebutton then click event will fire.

You can provide an event handler for the Click event to programmatically control the actions performed when the image button is clicked.

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

protected void Button1_Click(object sender, EventArgs e)

    {

        Label1.Text = "Hello";

    }

Here, when you click theimage Button then it will display message “Hello” in Label1

ImageButton Control in ASP.Net


Don't want to miss updates? Please click the below button!

Follow MindStick