Mega Code Archive

 
Categories / ASP.Net / Asp Control
 

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.rntsoft.com/style/logo.png"     onclick="SubmitBtn_Click"      runat="server" /> </form> </BODY> </HTML>