Im using Google API, and when trying to set from geocoding an address I get browser problems... ive also wrapped everything in updatepanels
Anyone have any solution, I've put it up at
Used url shortener to obfiscate url from a (mostly public) listing until Ive completed project.
http://www.tiny.cc/googlemapproblem
You can see my problem.
I am seeing the map if I click the search button twice. But it promptly dissapears.
Unsure how I can fix this... Any ideas?Code:Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click 'key Dim GMapKey As String = "your_api_key_here_removedforsecurity" Try Dim gmapRequest As String = "http://maps.google.com/maps/geo?key=" & GMapKey & "&q=" & txtSearchAddress.Text & "," & txtSearchCity.Text & "," & drpSearchState.SelectedItem.ToString & "&sensor=false&output=xml" Dim results As GMapGeocoder.Containers.Results = GMapGeocoder.Util.Geocode(txtSearchAddress.Text & "," & txtSearchCity.Text.ToString & "," & drpSearchState.SelectedItem.Text.ToString & " " & txtSearchZip.Text.ToString, GMapKey) Dim match1 As GMapGeocoder.Containers.USAddress = results.Addresses(0) Dim city As String = match1.City Dim state As String = match1.StateCode Dim lat As Double = match1.Coordinates.Latitude Dim lon As Double = match1.Coordinates.Longitude Dim resstr As String = match1.FullText & match1.Accuracy.ToString lblResult.Text = "debug on: " & lat & "," & lon & "<br/>" & resstr lblResultLeft.Text = lat & "," & lon 'Build script here 'js.Text = "<script type=""text/javascript"">" & _ ' "function initialize() {" & _ ' " //-34.397, 150.644 " & _ ' " var latitude = " & lblResultLeft.Text & _ ' " //var longitude = document.getElementById(""lblResultLeft"") " & _ ' " var latlng = new google.maps.LatLng(latitude); " & _ ' " var myOptions = { " & _ ' " zoom: 8," & _ ' " center : latlng, " & _ ' " mapTypeId : google.maps.MapTypeId.ROADMAP() " & _ ' " }; " & _ ' " var map = new google.maps.Map(document.getElementById(""map_canvas""), myOptions); " & _ ' " } " & _ ' "</script> " 'js.Text = "<script type='text/javascript'>" & vbCrLf & _ ' " initialize();" & vbCrLf & _ ' "</script>" btnSearch.OnClientClick = "javascript:initializesetmap(" & lblResultLeft.Text & ");" Catch ex As Exception End Try End Sub


Reply With Quote



Bookmarks