I have an ASP.NET MVC application which is pretty simple so far, but I want to add a driving directions page to the clients location. I see plenty of examples using the traditional code behind model but none with ASP.NET MVC. The application uses master pages and content pages.
I'm pretty new to ASP.NET MVC, so bear with me. Any examples of doing this would be much appreciated.
PS: I'm not totally against integrating a standard code behind type page in the application if needs be.
I think tvanfosson is correct; you should look at JavaScript examples. The fact that you're using ASP.NET MVC won't really affect your Google Maps code. Write the Google maps code in one of your view content pages just as you would in a standard ASP.NET application, or even just a plain HTML + JavaScript application. The only difference is that you will want to dynamically add JavaScript variables or parameters so your Google Maps code can use it.
I think you should not put any of your logic in a code-behind file. It will keep your project cleaner to keep logic in the controller, and using a code-behind won't really help you here. Instead have your controller perform the logic and hand the results to the view in the ViewData.
I'd probably look for examples that interact through Javascript rather than via .NET interface. Check out the Google Maps API documentation at http://code.google.com/apis/maps/documentation/index.html, examples at http://code.google.com/apis/maps/documentation/examples/index.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With