unable to show bing in visual webpart

Sep 2, 2010 at 10:32 AM

Hi,

i am trying to show simple bing in sp2010 visual webpart. i have html code which is working as expected in html page. when i place same code in visual webpart then it is giving error.

error says mapcontrol.ashx throw unhandled exception...

 

do you have any idea how to show simple bing map by using visual webpart in sp2010.

 

my code as follows..

<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&mkt=en-us"></script>

<script>
    var map;
     {
        map = new VEMap('myMap');
        map.LoadMap();


        var pin = new VEPushpin(1, new VELatLong(17.391, 78.4712), null,
  'Hyd Infy',
  '<table><tr><td>This field is:<ul><li>Total Buildings:20</li><li>Employees :xxxxx</li>' +
  '</ul></td></tr></table>');

 

        map.AddPushpin(pin);


    }
 
</script>


    <div id="myMap" style="position:relative;width:600px;height:400px;"></div>

 Thanks

Coordinator
Sep 5, 2010 at 2:28 AM

Hi,

Do you include the reference to Bing maps? http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2, this is the reference that i used in my webpart, you will add it to the page, user control, if you not include the reference you can't work with bing.

Fabián

Coordinator
Sep 5, 2010 at 2:31 AM

Sorry, I saw your reference after sent the email :). Can you try to put your site in the "security site" in your Internet Explore"? Why do you do a small test? creating a page and when the test work fine, you can move it to SharePoint 2010.

Fabián