Deal with button action event arguments: x, y coordinates (C#) : Image Button « Asp Control « ASP.Net






Deal with button action event arguments: x, y coordinates (C#)

<%@ Page Language="C#" %>
<script runat="server">
    protected void btnElephant_Click(object sender, ImageClickEventArgs e)
    {
        lblX.Text = e.X.ToString();
        lblY.Text = e.Y.ToString(); 
    }
</script>
<html>
<head>
    <title>Show EventArgs</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    <asp:ImageButton
        id="btnElephant"
        ImageUrl="http://www.java2s.com/style/logo.png"
        Runat="server" OnClick="btnElephant_Click" />
    
    <br />
    X Coordinate:
    <asp:Label
        id="lblX"
        Runat="server" />
    <br />
    Y Coordinate:
    <asp:Label
        id="lblY"
        Runat="server" />
    
    </div>
    </form>
</body>
</html>

           
       








Related examples in the same category

1.Determining the Coordinates Clicked on the Image of an ImageButton Control (VB.net)
2.Simple ImageButton control (VB.net)
3.asp:ImageButton AlternateText (VB.net)
4.For loop inside asp:ImageButton Click event (VB.net)
5.Set ImageUrl for asp:Image (VB.net)
6.Use Image Button event (VB.net)
7.Get Image Button mouse cursor coordinates (C#)
8.Get position from ImageClickEventArgs
9.Link Javascript function to OnClientClick event