views:

1943

answers:

8

I'm wanting to use google maps and see a million ways to do it on the web. Some are javascript methods and some are asp.net server components with which I have hit and miss luck. What's the easiest and most reliable way using c# and asp.net?

I have my location data including geocodes in a database. I want to provide users a method to do a lookup for certain locations. From there, my code will provide a table of geocodes to google maps with markers on the map corresponding to the found entries. Users can see each entry and need to be able to tell which is which if multiple rows are returned.

Is there a good way to do this?

+11  A: 

The Google Maps API is accessed via JavaScript (any server controls are just abstracting this away from you). In the case you described, you would need to dynamically output the required JavaScript to tell the maps API what to display.

See http://dotnet.sys-con.com/node/171162

John Sheehan
+2  A: 

I would recommend using direct JavaScript to create the Google Maps. It's fairly straight forward and then you will be able to understand what's going on behind the scenes.

Google has some pretty good tutorials and documentation to get you up and running quick. Once you add one to your site, it will become very easy to setup the rest of the customization that you need.

Take a look at this site for examples.

http://code.google.com/apis/maps/documentation/examples/

Ryan Smith
+5  A: 

There are a few server controls to do it, like this, but you have to learn how to do things in one way (server control) or another (Javascript Google API).

I recommend using the Google API, since it has more samples all over the web, and you can use new features implemented by Google right after they release them and don't have to wait for the server control developer to do it.

Eduardo Molteni
+1  A: 

As usual I point to ComponentOne who has a nice SilverLight control for this that can use google-maps or Microsofts Live Maps, it uses Silverlight Deep Zoom to handle it nicely: http://www.componentone.com/SuperProducts/MapsSilverlight/

Live example: http://demo.componentone.com/Silverlight/Factories/

(I'm not from ComponentOne, just a satisfied customer) ;)

I know you can do it yourself with scripts and other ways, but its just so much more fun to use code allreade written. ;)

Stefan
I dont understand why this is downvoted. This silverlight component are easy to use, supports maplayers, connectable to the geodata in the database. Everything needed in the question.
Stefan
And total overkill.
John Sheehan
Its not overkill to those needing these features. Looks pretty nice to me, getting +1 voted just to restore equilibrium
Owen
Yes, the question was both about webcontrols, serverside, JavaScript and everything, so why not list all those here, then everyone interested in Google maps can choose for them self.Thanks John. ;)
Stefan
+1  A: 

BTW: I found a great post here that has an example on how to do a store lookup. Works really well. I recommend!!

http://blog.donnfelker.com/post/HOWTO-Build-a-Store-Locator-in-ASPNET.aspx

Bill
The link is bad.
Keltex
A: 

Check out this example: Data driven Google Maps in ASP.Net

I used ASP.Net Ajax to create a web-service that is callable from JavaScript. The web-service talks to the database and fills a very basic object. ASP.Net Ajax, then makes the object available to my client javascript. The rest is easy: In the client, you call the webservice from Javascript, read the data returned and populate Google Maps, using simple Google Maps API calls.

Check out the site at link text

Rajah
A: 

Please, try my GoogleMaps control for ASP.NET

Subgurim