articles

Home / DeveloperSection / Articles / ImageButton in ASP.Net

ImageButton in ASP.Net

Pushpendra Singh7537 12-Oct-2010

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 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 in ASP.Net


Updated 04-Mar-2020

Leave Comment

Comments

Liked By