Hi Gary,
I really appreciate the quick response, but it is not entirely what I am trying to achive. Let me elaborate on that. Marker is a small area inside the feature( similar to the PointShape) and it triggers only when the user's cursor moves over it. I need to have an area hover, when the mouse moove enters the area from any direction just as you have in the sample "Highlight a Feature While Hovering". The information needs to be displayed in a of a choice on the page not related to the marker's position.
I could create a transparent image with the bounding box for each feature but it is just like creating another image map - reinventing the weel.
What I want is to capture mouse coordinates on the client using jquery, then iside that method trigger the OnClientClick event on the Map control, which in turn should post back to the server as a normal Map1_Click, the Map control is wrapped inside My User control something like the below code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MapHost.aspx.cs" Inherits="TestMapSuite_Web.MapHost" %>
<%@ Register Assembly="WebEdition" Namespace="ThinkGeo.MapSuite.WebEdition" TagPrefix="cc1" %>
<%@ Register src="~/Controls/Map/MapLoader.ascx" tagname="MapLoader" tagprefix="uc1" %>
-->
Display a Simple Map
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("#map").mousemove(function(e) {
var relativeX = e.pageX - this.offsetLeft;
var relativeY = e.pageY - this.offsetTop;
$('#mapTest').html('e.pageX = ' + e.pageX + ', e.pageY = ' + e.pageY + '
' + relativeX + ' ' + relativeY + '
' + screen.width + ',' + screen.height);
OnClientClick(e); //<-- passing event to the click function
});
testMap(); // <-- or simulate the click event on the map element
});
function OnClientClick(event) {
//alert("OnClientClick: " + event.pageX);
// If you return false, execute no more callbacks that means the server-side click event won't be triggered,
// prevent the postback to happen
//return false;
var map2 = document.getElementById(Map2);
alert("Testing Clik " + map2.clientId + " " + map2.tagName);
return true;
}
function testMap () {
var OnMapCreated = function(map) {
alert("Testing Clik " + map.clientId);
//var map2 = document.getElementById('Map2');
var el = document.getElementById(map.clientId);
$(el).trigger("click");
}
}
</script>
<form> id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<uc1:MapLoader ID="MapLoader1" runat="server" OnMapClicked="MapLoader1_MapClicked"/>
</ContentTemplate>
</asp:UpdatePanel>
<asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="LinkButton" OnClick="BulletedList1_Click" >
<asp:ListItem Value="#" Text="Henan"></asp:ListItem>
</asp:BulletedList>
</form>
------- The MapLoader Usaer Control ----
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MapLoader.ascx.cs" Inherits="TestMapSuite_Web.Controls.Map.MapLoader" %>
<%@ Register Assembly="WebEdition" Namespace="ThinkGeo.MapSuite.WebEdition" TagPrefix="cc1" %>
<cc1:Map ID="Map2" runat="server" Height="480px" Width="750px" OnClick="Map2_Click" OnClientClick="OnClientClick">
</cc1:Map>