Google maps geocache working in .html but not in .net

Hi Guys,
I’ve been practising with the google maps api and am getting quite frustrated.
I took an example from the google code playground and pasted it straight into an html file, no problem, works fine.

However, when I place that same code into an aspx file, it stops working.
The map itself loads fine, as does the controls, but when it get’s to actually trying to do the geocaching part (Having a user type in an address and have it display a pushpin on the map) it grinds to a halt.

Here’s my javascript in the head


 var map = null;
        var geocoder = null;

        function initialize() {
            if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map_canvas"));
                map.setCenter(new GLatLng(37.4419, -122.1419), 13);
                geocoder = new GClientGeocoder();
            }
        }

        function showAddress(address) {
            if (geocoder) {
                geocoder.getLatLng(
          address,
          function (point) {
              if (!point) {
                  alert(address + " not found");
              } else {
                  map.setCenter(point, 13);
                  var marker = new GMarker(point);
                  map.addOverlay(marker);
                  marker.openInfoWindowHtml(address);
              }
          }
        );
            }
        }

Form for inputting an address to geocache:


<form action="#" onsubmit="showAddress(this.address.value); return false">
       <p>
         <input type="text" size="60" name="address" value="1600 Amphitheatre Pky, Mountain View, CA" />
         <input type="submit" value="Go!" />
       </p>
       <div id="map_canvas" style="width: 500px; height: 300px"></div>
     </form>

Then just added the following to the body tag:


 onload="initialize()" onunload="GUnload()"

Can anyone tell me why this isn’t working?

I’m guessing it’s completely down to the form and how ASP.NET handles it, but forms in ASP.NET (and asp.net itself) are new to me, so I’m sure it’s something simple.

If anyone could shed some light on this I’d very much appreciate it.

Aha,
Yes, you are correct.
I couldn’t see it before because it was in the masterfile that the aspx page was based on.
Just after the opening body tag there is an opening form element and just before the closing body tag, the form tag closes.

So yes, everything is inside one form (run at server).

I’ve just used a normal button now and everything seems to be working fine (Finally, I spent ages trying to figure this out).

So what does that mean then if I want to submit forms in aspx pages?
If everything is enclosed in a form, then how can I put a form on a page and submit just that and not the parent form?
Or is that just not how it’s done?

The form does not have to be on the master. But most of the time it is. You do not post to other pages often in .net. Just do a postback on itself and handle everything there

Just a quick update.
I’ve made a separate google maps app previously that does directions to and from a location.
Work fine in html but not in aps.net, so I’m 95% sure that the issue is regarding the form input from the user.

Still don’t have a solution though.

Are you sure your form is not inside another bigger form and the submit button is not trying to submit it? Is there a reason it needs to be in a form? You can just create a js method and just call the from button click that returns false so not postback is created, then grab the value from the textbox and call your method. Using jQuery should also make your life a lot easier