ToolTip on progammatically generated ImageMap?

2 posts, 0 answers
  1. jlj30
    jlj30 avatar
    102 posts
    Member since:
    Jan 2011

    Posted 04 Jun 2013 Link to this post


    I have examined the ImageMap / RadToolTipManager demo, but my situation is a bit different.
    I am using a product that builds diagrams which are then rendered using an ImageMap.
    Here is a sample from the page source.  I've only shown a few lines of the map:

    <MAP NAME='_mfusion_ctl00_ContentPlaceHolder_DiagramView1_ImageMap_0_0'>
    <AREA SHAPE='POLY' COORDS='1385,113,1468,113,1468,113,1473,114,1476,117,1479,120,1480,125,1480,125,1480,125,1480,178,1480,178,1479,182,1476,186,1473,188,1468,189,1468,189,1385,189,1385,189,1381,188,1377,186,1375,182,1374,178,1374,125,1374,125,1375,120,1377,117,1381,114,1385,113'
                TITLE="TASK DESCRIPTION: Ensure that all relevant user info has been checked ROLE DUTIES: " ID="_mfusion_ctl00_ContentPlaceHolder_DiagramView1_ImageMap_0_0_20" href="javascript:document.getElementById('_mfusion_ctl00_ContentPlaceHolder_DiagramView1_ClickedItem').value = '20:-1:-1:-1';__doPostBack('ctl00$ContentPlaceHolder$DiagramView1','_mfusion_ctl00_ContentPlaceHolder_DiagramView1_ClickedItem');">

    So my question is, how do I go about iterating through this in much the same fashion as your demo does, for an ImageMap that was not created declaratively?

    Thanks for any advice.

  2. Marin Bratanov
    Marin Bratanov avatar
    4428 posts

    Posted 06 Jun 2013 Link to this post

    Hi Jim,

    You can still iterate through the areas of the map with JavaScript, just as shown in the demo. It does not matter where the image map is created, it is going to be available for a script that comes after the rendered map. You can use the window.onload event to delay the execution of the code that adds ids for the areas. This will ensure the HTML is loaded, yet it is before the Sys.Application.Init event when the RadToolTips are created. The targets for the tooltip manager can be added when you generate the map.

    I am not sure how you generate the maps, but you can also add attributes to the areas, so the onmouseover (or onclick) event calls a JavaScript function that will show a tooltip for it. You can use the RadToolTipManager client-side API for this, and a parameter to this function can be this (the element itself) and a custom value that you need for your own logic).

    Marin Bratanov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top