views:

1056

answers:

6

Clarification:

Put simply, I'd like to put an ASP.NET UpdatePanel inside the info window of Google Maps. This would mean that users could interact with my application from within an info window, without refreshing the page and without closing the currently open info window.

Does anyone know if this is possible?


Update:

Thank you to all those who have so far responded. Very much appreciated.

What I have gleaned from the answers is that:

  • the update panel has it's own "mysterious mechanics" which might be causing the UpdatePanel to not work correctly inside the InfoWindow. Going down the more direct route of using JQuery to make ajax calls to simple web services should eliminate the hidden complexity of the UpdatePanel and enable the functionality I want.

I am still intrigued as to why the UpdatePanel approach does not work, and as to why using one would "break the model" of Google Maps, when surely an UpdatePanel merely renders as HTML and javascript with a link to the XMLHttpRequest object.


Is it possible to place ASP.NET code inside Google Maps info window?

I'd like to place an UpdatePanel with some AJAXified asp:Button's inside the info window.

AFAICT you simply provide the HTML to place in the info window as a string, so was thinking of rendering a UserControl to a string and placing that string in the info window for the browser to render. Does anyone know if this is likely to work?

If this is not possible in Google maps, does anyone have any idea whether such an implementation would be possible with the corresponding Virtual Earth technology?

+1  A: 

VirtualEarth has tigether integration with SilverLight, which should mean that you'll have greater .NET control over your web mapping application. With most Google Maps implementations that we've done we typically just use pure HTML/JavaScript/CSS solutions to create AJAX functionality. Thus we would inject HTML/javascript into the InfoWindow class, for any custom functionality that we needed.

Blake Blackwell
+1  A: 

José Basilio is right. Instead, use $jquery Live Events and put regular HTML in the Info Window then use Ajax calls with jQuery to get the interactivity you want. Reframe the problem.

Scott Hanselman
Hi Scott. Really value your input. I'm not yet familiar with $jquery Live Events, but I'll look into them as a possible solution.
Ben Aston
Bounty awarded to Scott because, while it doesn't provide me with a complete understanding of the "why's", he was the first (albeit of many) to suggest this route in an answer. Credit to José Basilio for his comment.
Ben Aston
+1  A: 

I'm not sure I'd take this approach, but if you want to get ASP.NET code within an info window, you could use an iframe.

Alternatively have you considered an ASP.NET control such as GoogleMap Control, which would handle all the integration for you?

Rich

kim3er
I have tried using the control you mentioned but have so far failed to get the update panel working from within the info window (no doubt for the reasons given by José Basilio and Scott Hanselman), although ASP.NET controls can be added to the info window using this control quite conveniently.
Ben Aston
I think the trick is that the info window does not exist until created by JavaScript. In this scenario I would be using jQuery and ASP.NET Web Services to populate the windows as required.It is my understanding that the Google Map Control is a good option if you want to keep all your logic in the server code and delegate the JavaScript to an API. As for why it is not working, I'm afraid I rarely work with UpdatePanels.Rich
kim3er
Matt Sherman
+2  A: 

Consider another approach and possibly. What you are really looking for is to be able to respond to a server side event. Maybe something like this if you really and truely need to respond to server side events.

http://windyroad.org/2006/07/25/event-driven-ajax-part-1-pushing-server-side-events/

Once you are handling the events on the client in javascript you can do whatever you like to the map

Martin Murphy
+1  A: 

UpdatePanel != AJAX. Take a look at using jQuery to make Ajax calls ($.ajax) and creating simple web services/etc. to achieve what you're after. While technically you could wiggle an UpdatePanel into there somehow, it just isn't worth it.

Look here for an excellent example on calling AJAX/web methods with jQuery.

Nicholas H
Thanks Nicholas. The link you supply is a useful resource. Please can you clarify what you mean by the UpdatePanel not being Ajax. I understand what ajax is, using XMLHttpRequest to pass information to the server. Surely this is all the UpdatePanel is doing though?
Ben Aston
A: 

Have you looked at the ExtInfoWindow control? Since you did not state your problem, I can't say whether it is a solution, but it seems that it should be mentioned here.

cdonner