Export (0) Print
Expand All

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)

public sealed class ImageClickEventArgs : EventArgs
public final class ImageClickEventArgs extends EventArgs
public final class ImageClickEventArgs extends EventArgs
Not applicable.

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.

NoteNote:

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() + ")";
}

System.Object
   System.EventArgs
    System.Web.UI.ImageClickEventArgs

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 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft