This documentation is archived and is not being maintained.

ImageClickEventArgs Class

Provides data for any events that occur when a user clicks an image-based ASP.NET server control, such as the HtmlInputImage or ImageButton server controls. This class cannot be inherited.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class ImageClickEventArgs : EventArgs

This class passes the location where a user clicked an HtmlInputImage server control or an ImageButton Web server control. Clicking an HtmlInputImage server control causes a ServerClick event to occur, while clicking an ImageButton server control causes a Click event to occur. You can then use event handlers to programmatically respond to the event based on the value of these coordinates.


The origin coordinates (0,0) are located at the upper left corner of the image.

Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

The following code example demonstrates an ASP.NET page that uses the information provided by this class to display the coordinates of a user's click on an image.

// Define the event handler that uses coordinate information through ImageClickEventArgs. 
void ImageButton_Click(object sender, ImageClickEventArgs e) 
   Label1.Text = "You clicked the ImageButton control at the coordinates: (" + 
                 e.X.ToString() + ", " + e.Y.ToString() + ")";


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0