Microsoft Developer Network > Forums Home > Windows Live Developer Forums Forums > Bing Maps: Map Control Development > How do I display HTML <table> on the map based on a clicking of a shape?
Ask a questionAsk a question
 

AnswerHow do I display HTML <table> on the map based on a clicking of a shape?

  • Thursday, November 05, 2009 11:32 PMJayViz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have a map where the user can click on a checkbox and various shapes are display, ie; ZIPs or counties.  I'm using the ASP.NET handler (.ashx) to query the database for the particular shape and then format it for the map.

    Now I'd like for the user to click on that shape and display an HTML table of say, the population of that ZIP code (shape) there on the map.

    I've captured the ZIP shape "ID" on the "map.AttachEvent("onclick", shape_onclick);" and pass that to the Handler for the lookup. I've even formatted the returned data from the database into the HTML table in the Handler. 

    So my question is: how do I pass this HTML table to the browser?  Or is this even the correct approach?

    In my Handler for the shapes, I do a "context.Response.ContentType = "text/JavaScript";" so the browser knows I'm sending JavaScript commands.

    What do I do to tell the browser this is HTML?

    Thanks in advance for your help.

    Jay

Answers

  • Friday, November 06, 2009 12:16 PMRichard_BrundrittMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Set the ContentType to "text/plain". Thios will pass the HTML as a string. In the call back to your handler use javascript to grab the id of the div you want to insert this table into and do something like this:

    document.getElementById('your_div_Id').innerHTML = your_response_text;
    Windows Live Developer MVP - http://rbrundritt.spaces.live.com
    • Marked As Answer byJayViz Saturday, November 07, 2009 3:09 AM
    •  

All Replies

  • Friday, November 06, 2009 12:16 PMRichard_BrundrittMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Set the ContentType to "text/plain". Thios will pass the HTML as a string. In the call back to your handler use javascript to grab the id of the div you want to insert this table into and do something like this:

    document.getElementById('your_div_Id').innerHTML = your_response_text;
    Windows Live Developer MVP - http://rbrundritt.spaces.live.com
    • Marked As Answer byJayViz Saturday, November 07, 2009 3:09 AM
    •  
  • Friday, November 06, 2009 3:19 PMJayViz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks.  I'll give that a try.