Determining the Coordinates Clicked on the Image of an ImageButton Control (VB.net) : Image Button « Asp Control « ASP.Net

Home
ASP.Net
1.ADO.net Database
2.Ajax
3.Asp Control
4.Collections
5.Components
6.Data Binding
7.Development
8.File Directory
9.HTML Control
10.Language Basics
11.Login Security
12.Mobile Control
13.Network
14.Page
15.Request
16.Response
17.Server
18.Session Cookie
19.Sitemap
20.Theme Style
21.User Control and Master Page
22.Validation by Control
23.Validation by Function
24.WebPart
25.WPF
26.XML
ASP.Net » Asp Control » Image Button 
Determining the Coordinates Clicked on the Image of an ImageButton Control (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

End Sub
Sub SubmitBtn_Click(Sender As Object, E As ImageClickEventArgs)
    Dim String1 as String
    Dim String2 as String
    If E.X < 18 then
        String1 = "Left"
    Else
        String1 = "Right"
    End If
    If E.Y < 18 then
        String2 = "Top"
    Else
        String2 = "Bottom"
    End If
    lblLocationClicked.Text = "You clicked in the " & String2 _
        "-" & String1 & " portion of the image."
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Determining the Coordinates Clicked on the Image of an ImageButton Control</TITLE>
</HEAD>
<form runat="server">
<asp:label 
    id="lblLocationClicked" 
    runat="server"
/>
<BR><BR>
<asp:imagebutton 
    id="imagebutOK"
    alternatetext="View Coordinates"
    imageurl="http://www.java2s.com/style/logo.png"
    onclick="SubmitBtn_Click" 
    runat="server"
/>
</form>
</BODY>
</HTML>
           
       
Related examples in the same category
1.Simple ImageButton control (VB.net)
2.asp:ImageButton AlternateText (VB.net)
3.For loop inside asp:ImageButton Click event (VB.net)
4.Set ImageUrl for asp:Image (VB.net)
5.Use Image Button event (VB.net)
6.Deal with button action event arguments: x, y coordinates (C#)
7.Get Image Button mouse cursor coordinates (C#)
8.Get position from ImageClickEventArgs
9.Link Javascript function to OnClientClick event
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.