ThinkGeo.com    |     Documentation    |     Premium Support

ContextMenuItem Click Issue

I have a map on my ASPX page that does something when a user clicks it. I am also trying to integrate a contect menu into map control and the click event of the Map1 control is firing but not the click event of the ContextMenuItem. I have added a hander to the click event of the ContextMenuItem but it never gets fired. I am also calling a client side script when the users clicks a shapefile feature to indicate the zoom level so the user can't click a shape outside of a ceartain zoom level.


Thanks.



Jeff,  
  
 This is a bug that the map’s events conflict with the ContextMenuItem’s click event. Thanks for pointing it out and we are working on it right now, hopefully it will be fixed in the next version. 
  
 Thanks, 
  
 Ben 


Jeff,  
  
 Just let you know we have figured it out and it will be fixed in the coming version. 
  
 Ben 


Thanks for responding to me on this. Do you have an ETA on when the next version of the GIS control will be released? Do you guys have a work around you could recommend until the new version is released? Of course I will need to know what section of the control the user clicked to show them an appropriate context menu. 
  
 Thanks 
 Jeff

Jeff,  
  
 Here is a temporary workaround, Add the following script to the Header tag block in your aspx file and it will be fine.  
 
function OnMapCreated(map) {
 map.events.register(‘mousedown’, map, function(e) {
 var ctxDiv = document.getElementById(“contextMenuId”);
  if (ctxDiv) {
 ctxDiv.parentNode.removeChild(ctxDiv);
 this.div.parentNode.appendChild(ctxDiv);
 }
 });
 }
 
  Let me know if you have any issues. 
  
 Ben

Thanks for the help Ben. I do have one question however. Do we still need to add a handler for the click event in the code behind as is demonstrated in the code included with the sample app?

Jeff,  
  
 Yes, you still need to add the handler for the click event in the code behind.  The above script is just a patch to work around the conflicting problem, in the coming version we will not need this script. 
  
 Thanks, 
  
 Ben

It worked like a champ Ben.


Thanks for all of your help.


Jeff



It’s my pleasure, Jeff.