Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

google maps multiple points marker

Avatar of dmiebim
dmiebimFlag for Turkey asked on
Microsoft DevelopmentWeb ApplicationsEditors IDEs
4 Comments1 Solution4732 ViewsLast Modified:
Hi all;

How to view messages for each point separately.
points comes from the database dynamically (multiple points)

My code (vb.net code behind)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Try
                Dim myGoogleMap As New StringBuilder
                myGoogleMap.Append("<script src='http://maps.google.com/maps?file=api&v=2&key=**************'" + vbCrLf)
                myGoogleMap.Append("type='text/javascript'></script>" + vbCrLf)
                myGoogleMap.Append("<script type='text/javascript'>" + vbCrLf)
                myGoogleMap.Append(vbCrLf + vbCrLf)
                myGoogleMap.Append("var map = null;" + vbCrLf)
                myGoogleMap.Append("var mapObj = null;" + vbCrLf)
                myGoogleMap.Append("var geoCoder = null;" + vbCrLf)
                myGoogleMap.Append(vbCrLf + vbCrLf)
                myGoogleMap.Append("mapObj = document.getElementById('map');" + vbCrLf)
                myGoogleMap.Append("map = new GMap2(mapObj);" + vbCrLf)
                myGoogleMap.Append("geocoder = new GClientGeocoder();" + vbCrLf)
                myGoogleMap.Append("map.setCenter(new GLatLng(39.9725,32.8636), + 6);" + vbCrLf)
                'myGoogleMap.Append("map.setCenter(new GLatLng(" + coordinate + "), + 5);" + vbCrLf)

                Dim dv As DataView = CType(sqlTesisler.Select(DataSourceSelectArguments.Empty), DataView)
                Dim latitude As String = ""
                Dim Longitude As String = ""
                Dim place As String = ""
                Dim coordinate As String = ""


                For i = 0 To dv.Table.Rows.Count - 1
                    latitude = dv.Table.Rows(i).Item("latitude").ToString()
                    Longitude = dv.Table.Rows(i).Item("Longitude").ToString()
                    place = dv.Table.Rows(i).Item("Adi").ToString()
                    coordinate = Replace(latitude, ",", ".") & "," & Replace(Longitude, ",", ".")

                    myGoogleMap.Append("var point = new GLatLng(" + coordinate + ");" + vbCrLf)
                    myGoogleMap.Append("map.addOverlay(new GMarker(point));" + vbCrLf)
                   'point message
                   '???????????????????????????????????
                Next

                myGoogleMap.Append("map.addControl(new GSmallMapControl());" + vbCrLf)
                myGoogleMap.Append("map.addControl(new GMapTypeControl());" + vbCrLf)
                myGoogleMap.Append("GMap2.prototype.wheelZoom = function(event)" + vbCrLf)
                myGoogleMap.Append("{ if((event.detail || -event.wheelDelta) < 0)" + vbCrLf)
                myGoogleMap.Append("  { map.zoomIn();} else { map.zoomOut();}" + vbCrLf)
                myGoogleMap.Append("return false; " + vbCrLf)
                myGoogleMap.Append("} " + vbCrLf)

                myGoogleMap.Append("GEvent.addDomListener(mapObj, 'DOMMouseScroll', map.wheelZoom); " + vbCrLf)
                myGoogleMap.Append("GEvent.addDomListener(mapObj, 'mousewheel', map.wheelZoom);" + vbCrLf)
                myGoogleMap.Append("GEvent.addListener(map, 'click', function(marker, point) { map.setCenter(point); } ); " + vbCrLf + vbCrLf)

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

                myGoogleMap.Append("</script>")

                If (Not Me.ClientScript.IsStartupScriptRegistered("StartMap")) Then
                    Me.ClientScript.RegisterStartupScript(GetType(String), "StartMap", myGoogleMap.ToString())
                End If
            Catch ex As Exception
                txtDurum.Text = "Error : " & ex.Message
            End Try

        End If
    End Sub
googlemap.JPG
ASKER CERTIFIED SOLUTION
Avatar of mmarx82
mmarx82Flag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers