title: Having unspecified errors and a few issues when running google maps
body: <p><strong>ISSUE 1</strong></p>
  
  <p>I tried to get the geo code after entering the address. After i clicked on the GeoCode button, it prompts me unspecified errors. </p>
  
  <p>I have a page Register.aspx (no update panel) with a button "View", it will call ucGoogleMap.ascx when i clicked on the button.</p>
  
  <p>Below is the javascript and html codes in ucGoogleMap.ascx.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no" /&gt;
  &lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  
      $(document).ready(function () {
          $get('&lt;%=height.ClientID%&gt;').value = $(window).height();
      });
  
     var geocoder = new google.maps.Geocoder();
  
     function geocodePosition(pos) {
         debugger;
          geocoder.geocode({
                  latLng: pos
              }, function (responses) {
                  if (responses &amp;&amp; responses.length &gt; 0) {
                      updateMarkerAddress(responses[0].formatted_address);
                  } else {
                      updateMarkerAddress('Cannot determine address at this location.');
                  }
              });
      }
  
      function updateMarkerStatus(str) {
          document.getElementById('markerStatus').innerHTML = str;
      }
  
      function updateMarkerPosition(latLng) {
          document.getElementById('info').innerHTML = [
              latLng.lat(),
              latLng.lng()
          ].join(', ');
      }
  
      function updateMarkerAddress(str) {
          document.getElementById('address').innerHTML = str;
      }
  
      function initialize() {
          var latLng = new google.maps.LatLng(19.0606917, 72.83624970000005);
          var map = new google.maps.Map(document.getElementById('mapCanvas'), {
              zoom: 18,
              center: latLng,
              mapTypeId: google.maps.MapTypeId.ROADMAP
          });
  
          var domainName = document.getElementById('&lt;%=hdnDomainName.ClientID %&gt;').value;
          var marker = new google.maps.Marker({
              position: latLng,
              title: 'Point A',
              map: map,
              icon: domainName + 'Images/maker.png',
              draggable: true
          });
  
          // Update current position info.
          updateMarkerPosition(latLng);
          geocodePosition(latLng);
  
          // Add dragging event listeners.
          google.maps.event.addListener(marker, 'dragstart', function () {
              updateMarkerAddress('Dragging...');
          });
  
          google.maps.event.addListener(marker, 'drag', function () {
              updateMarkerStatus('Dragging...');
              updateMarkerPosition(marker.getPosition());
          });
  
          google.maps.event.addListener(marker, 'dragend', function () {
              updateMarkerStatus('Drag ended');
              geocodePosition(marker.getPosition());
          });
      }
  
      function codeAddress() {
          debugger;
          var domainName = document.getElementById('&lt;%=hdnDomainName.ClientID %&gt;').value;
          var address = document.getElementById('&lt;%= txtAddress.ClientID %&gt;').value;
          geocoder.geocode({ 'address' : address }, function (results, status) {
              if (status == google.maps.GeocoderStatus.OK) {
                  var map = new google.maps.Map(document.getElementById('mapCanvas'), {
                      zoom: 18,
                      center: results[0].geometry.location,
                      mapTypeId: google.maps.MapTypeId.ROADMAP
                  });
                 // map.setCenter(results[0].geometry.location);
                  var marker = new google.maps.Marker({
                      position: results[0].geometry.location,
                      title: 'Point A',
                      map: map,
                      icon: domainName + 'Images/maker.png',
                      draggable: true     
                  });
              } else {
                  alert('Geocode was not successful for the following reason: ' + status);
              }
              
              // Update current position info.
              updateMarkerPosition(results[0].geometry.location);
              geocodePosition(results[0].geometry.location);
  
              // Add dragging event listeners.
              google.maps.event.addListener(marker, 'dragstart', function () {
                  updateMarkerAddress('Dragging...');
              });
  
              google.maps.event.addListener(marker, 'drag', function () {
                  updateMarkerStatus('Dragging...');
                  updateMarkerPosition(marker.getPosition());
              });
  
              google.maps.event.addListener(marker, 'dragend', function () {
                  updateMarkerStatus('Drag ended');
                  geocodePosition(marker.getPosition());
              });
  
          });
          
      }
  
      // Onload handler to fire off the app.
      google.maps.event.addDomListener(window, 'load', initialize);
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>&lt;style type="text/css"&gt;
    #mapCanvas {
      width: 500px;
      height: 400px;
    }
  
    &lt;/style&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;asp:UpdatePanel runat="server" ID="upViewGoogleMap" UpdateMode="Conditional"&gt;
          &lt;ContentTemplate&gt;
            &lt;table cellpadding="0" cellspacing="0" border="0" width="100%"&gt;
                                                  &lt;tr class="clsTBRow" style="vertical-align: top"&gt;
                                                      &lt;td style="width: 500px;"&gt;
                                                          &lt;div id="mapCanvas"&gt;&lt;/div&gt;
                                                      &lt;/td&gt;
                                                      &lt;td style="padding-left: 10px;"&gt;
                                                          &lt;div id="infoPanel"&gt;
                                                              &lt;asp:HiddenField ID="hdnDomainName" runat="server"/&gt;
                                                              Location : &lt;asp:TextBox ID="txtAddress" value="Rawang, Selangor" runat="server"&gt;&lt;/asp:TextBox&gt;&amp;nbsp;
                                                              
                                                              &lt;asp:Button ID="cmdGeocode" runat="server" Text="Geocode" CausesValidation="false" /&gt;&lt;br/&gt;&lt;br/&gt;
                                                              &lt;b&gt;Marker status:&lt;/b&gt;
                                                              &lt;div id="markerStatus"&gt;&lt;i&gt;Click and drag the marker.&lt;/i&gt;&lt;/div&gt;
                                                              &lt;b&gt;Current position:&lt;/b&gt;
                                                              &lt;div id="info"&gt;&lt;/div&gt;
                                                              &lt;b&gt;Closest matching address:&lt;/b&gt;
                                                              &lt;div id="address"&gt;&lt;/div&gt;
                                                              &lt;br/&gt;
                                                              &lt;asp:Button ID="cmdAddPosition" runat="server" Text="Add Position" CausesValidation="false" /&gt;  
                                                          &lt;/div&gt;
                                                      &lt;/td&gt;
                                                  &lt;/tr&gt;
                                              &lt;/table&gt;
            &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>ISSUE 2</strong>
  domainName = '<a href="http://localhost:10101/project/" rel="nofollow">http://localhost:10101/project/</a>' &lt;--- LOAD RECORD IN THE CODE BEHIND to get the current domain name</p>
  
  <p>For the google map marker, I uses domainName + 'Images/maker.png' and the marker won't shows up. When I uses '<a href="http://localhost:10101/project/Images/maker.png" rel="nofollow">http://localhost:10101/project/Images/maker.png</a>' and the marker shows up.</p>
  
  <p>When i debug, i check both having the same results which is '<a href="http://localhost:10101/project/Images/maker.png" rel="nofollow">http://localhost:10101/project/Images/maker.png</a>'</p>
  
  <p><strong>ISSUE 3</strong></p>
  
  <p><strong>ucGoogleMap.ascx Code Behind</strong></p>
  
  <p>Currently using</p>
  
  <pre><code>cmdGeocode.Attributes.Add("onclick", "return codeAddress();")
  </code></pre>
  
  <p>i wan to use below code to call the javascript, but it doesn't seem like its functioning.</p>
  
  <pre><code> Protected Sub cmdGeocode_Click(sender As Object, e As EventArgs) Handles cmdGeocode.Click
          Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "codeAddress", "codeAddress();", True)
          upViewGoogleMap.Update()
      End Sub
  </code></pre>