Welcome, Guest
Username: Password: Remember me
Ask ASP.Net related questions here

TOPIC: Discuss Google Maps Control for ASP.Net

Discuss Google Maps Control for ASP.Net 9 years 5 months ago #12

  • shabdar
  • shabdar's Avatar
  • OFFLINE
  • Administrator
  • Posts: 79
  • Thank you received: 14
  • Karma: 7
Ask questions on Google Maps Control for ASP.Net here. Click reply button below.
Last Edit: 9 years 5 months ago by shabdar.
The administrator has disabled public write access.
The following user(s) said Thank You: lecongphu

Google Maps Control for ASP.Net - Part 2 9 years 5 months ago #42

  • ahmed0450
  • ahmed0450's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
Thank's for these usful contols, it's what am searching

but can you explane how can I add html button when it's clicked fire the event that show infowindow for specific marker
The administrator has disabled public write access.

Re: Google Maps Control for ASP.Net - Part 2 9 years 5 months ago #43

  • shabdar
  • shabdar's Avatar
  • OFFLINE
  • Administrator
  • Posts: 79
  • Thank you received: 14
  • Karma: 7
ahmed0450 wrote:
Thank's for these usful contols, it's what am searching

but can you explane how can I add html button when it's clicked fire the event that show infowindow for specific marker

You can do this by adding a javascript code to button click event. See code below,

<input id="btnOpenInfoWindow" value="Click to open info window" type="button"
onclick="markers.getValueById('2').openInfoWindowHtml('I am opened by a button click');" />


In code above, markers is a javascript object. getValueById function will search for a pushpin with ID '2'. openInfoWindowHtml() function would open InfoWindow.

To see this code in action, download attached MapWithClickablePushpins.aspx page. Replace it in my original sample and run it. You would see a button at bottom of page with above code.
Attachments:
Last Edit: 9 years 5 months ago by shabdar.
The administrator has disabled public write access.

Re: Discuss Google Maps Control for ASP.Net 9 years 5 months ago #48

  • caio
  • caio's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Hello,
I've a problem using your component on my webapp.

On the same page I'm using the mootools library, and it seems that there's some conflict using both in the same page.
In fact if I comment the include of mootools.js your ascx component works perfectly, but if I load the mootools.js the map isn't loaded.

The code that call the mootools library is called in this way:
window.addEvent('domready', function () { ... });

On the same page, without using your component, I was able to load a google map calling a function that create the map:
<script type="text/javascript">
 
         function initialize() {
             var myLatlng = new google.maps.LatLng(19.4270499, -99.1275711);
             var myOptions = {
                 zoom: 8,
                 center: myLatlng,
                 mapTypeId: google.maps.MapTypeId.ROADMAP
             }
             var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
             var bounds = new google.maps.LatLngBounds();
 
             // Center/zoom the map based on the bounds
             map.fitBounds(bounds);
             map.setCenter(bounds.getCenter());
         }

and calling it on the window.load event in this way:
<script type="text/javascript">
        window.onload = function () { window.onload; initialize(); } 
    </script> 

in your component instead I see that the script is called registering a startup script with this code:
sScript+= "<script language='javascript'> if (window.DrawGoogleMap) { DrawGoogleMap(); } </script>";
        Page.ClientScript.RegisterStartupScript(Page.GetType(), "onLoadCall", sScript);

I tryed to call the DrawGoogleMap on window.onload event but it didn't works.

Somebody can tell me how can I solve this problem?

thank you
Last Edit: 9 years 5 months ago by caio.
The administrator has disabled public write access.

Re: Discuss Google Maps Control for ASP.Net 9 years 5 months ago #49

  • shabdar
  • shabdar's Avatar
  • OFFLINE
  • Administrator
  • Posts: 79
  • Thank you received: 14
  • Karma: 7
Hi Caio

I tried to use mootools.js with ascx component. I think there is some javascript function or object conflict. I could not pin point exactly where problem is. But when I include mootools.js after GoogleMapAPIWrapper.js, it seems to work. i.e. Go to GoogleMapForASPNet.cs code behind and at the end of Page_Load() event change following code to include mootools.js. So instead of including mootools.js in <Head> tag, include it inbetween page. Hope that helps.
string sScript = "";
sScript += "<script src='http://maps.google.com/maps?file=api&amp;v=" + GoogleMapObject.APIVersion + ">&amp;key=" + GoogleMapObject.APIKey + "'  type='text/javascript'></script>";
sScript += "<script type='text/javascript' src='GoogleMapAPIWrapper.js'></script>";
sScript += "<script language='javascript'> if (window.DrawGoogleMap) { DrawGoogleMap(); } </script>";
sScript += "<script src='mootools-core.js' type='text/javascript'></script>";
 
Page.ClientScript.RegisterStartupScript(Page.GetType(), "onLoadCall", sScript);
Last Edit: 9 years 5 months ago by shabdar.
The administrator has disabled public write access.

Re: Discuss Google Maps Control for ASP.Net 9 years 4 months ago #50

  • caio
  • caio's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
thank you, something changed, but it didn't solve my problem.
If I try to load the mootools library after the google one like you suggested me, the map is loaded but the other components that use mootols doesn't work anymore.

Other suggestions?

thank you
The administrator has disabled public write access.

Re: Discuss Google Maps Control for ASP.Net 9 years 4 months ago #51

  • shabdar
  • shabdar's Avatar
  • OFFLINE
  • Administrator
  • Posts: 79
  • Thank you received: 14
  • Karma: 7
Hi Caio

I was anticipating that issue. Anyhow I further tried to debug where exactly is the problem. Problem is not with Google Map Control, but with ASP.Net Ajax functionality. Google Map control is using Ajax. Somehow mootools do not work very well when you use it with ASP.Net Ajax. Lot of people are facing this same issue.

What you can do to avoid this problem is rather than embedding google map directly on page where you are using mootools, create a new page with just google map control and then embed it within main page using IFrame. This will keep mootools and google map controls on separate pages, hence avoiding any conflicts between javascript libraries. Hope that helps.
Last Edit: 9 years 4 months ago by shabdar.
The administrator has disabled public write access.

Re: Discuss Google Maps Control for ASP.Net 9 years 4 months ago #62

  • shafiq
  • shafiq's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
Hi all,
I have a different scenario.i have a page which have companies details generated from database using ASP.NET(C#)(VS2005)....i want to show locations of each company on google map.
how i can do it...need help.
The administrator has disabled public write access.

Re: Discuss Google Maps Control for ASP.Net 9 years 4 months ago #63

  • morag
  • morag's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
Thanks very much for the excellent control and tutorial. I'd like t be able to change the Map/Satellite/Hybrid buttons. Is there any way of doing this?
The administrator has disabled public write access.

Re: Discuss Google Maps Control for ASP.Net 9 years 4 months ago #64

I recently used googlemapforaspnet. I connected the application to SQl database to read the lat and long and it works just fine.
The problem is that I want to attach a kml file to the map. Any help???
The administrator has disabled public write access.
The following user(s) said Thank You: nitesh
Time to create page: 0.495 seconds