ASP.NET ImageButton Control

The ImageButton control is used to display a clickable image.

C# Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Drawing;
using System.Web.UI.WebControls;

namespace asptutorial
    public partial class blankpage : System.Web.UI.Page

        protected void Page_Load(object sender, EventArgs e)

            ImageButton1.ImageUrl = "~/files/fastlearning.png";
            ImageButton1.AlternateText = "Fastlearning icon";
            ImageButton1.PostBackUrl = "";
            ImageButton1.ImageAlign = ImageAlign.Left;
            ImageButton1.DescriptionUrl = "Learn More and Enjoy More";
            ImageButton1.ToolTip = "Welcome to";



        <form runat="server">
        <asp:ImageButton ID="ImageButton1" runat="server" Height="100px" ImageUrl="~/files/fastlearning.png" ImageAlign="Left" AlternateText="Fastlearning Logo" ToolTip="Welcome to" PostBackUrl="" />


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

ASP.NET Control Standard Properties

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible
For a full description, go to Web Control Standard Attributes.

ASP.NET Web Control Standard Properties

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth, CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled, SkinID, Style, TabIndex, ToolTip, Width
For a full description, go to Web Control Standard Attributes.

Share this article on