I just wanted to share my VB.NET example to help others out. - Please do the same and feel free to comment on better ways of doing things.
Imports
System.Web.Configuration
Imports System.Data.SqlClient
Imports System.Data
Imports Reimers.WebControls
Imports Reimers.Map
Protected
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Map.GoogleKey = WebConfigurationManager.AppSettings("MapKey").ToString
If Not Page.IsPostBack Then
Map.Center = New GoogleLatLng(42.562539, -83.148805)
Map.Zoom = 15
Map.Controls.Add(New Reimers.Map.Controls.GoogleSmallMapTypeControl("smc"))
Map.Controls.Add(New Reimers.Map.Controls.GoogleSmallMapControl("sc"))
End If
'Handelers ********************
AddHandler Sidebar.Click, AddressOf Sidebar_Click
AddHandler Sidebar.Click, AddressOf Sidebar_Click
AddHandler Map.OverlayClick, AddressOf Me.Map_MarkerClick
'Handelers ********************
Sidebar.AlternatingItemStyle.BackColor = System.Drawing.Color.Blue
Sidebar.Overlays = Map.Overlays
End Sub
Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim UserName = HiddenField1.Value
Dim TourString As String = "SELECT dbo.tblDestinations.*, tblAddress.* FROM dbo.tblDestinations INNER JOIN tblAddress ON dbo.tblDestinations.DestinationID = tblAddress.DestinationID Where TourID= '" & ListBox1.SelectedValue & "'"
Dim con1 As String = WebConfigurationManager.ConnectionStrings("ConnectionStringTour").ConnectionString()
Dim Tours As New _
System.Data.SqlClient.SqlDataAdapter(TourString, con1)
Dim dst1 As New System.Data.DataSet()
Tours.Fill(dst1,
"tblDestinations")
Dim menuFile As String
menuFile =
""
Dim lat As String
Dim lng As String
Dim address As String
Dim city As String
Dim state As String
Dim zip As String
Dim tele As String
Dim name As String
Dim website As String
Dim logo As String
Dim MyOption As New Reimers.Map.GoogleMarkerOptions
Dim Baloon As String
Dim destinationID As String
Dim ic1 As New GoogleIcon("custom", "http://www.virtualeyes.net/royaloakchamber/icons/ATM.png", New GoogleSize(25, 30), New GooglePoint(16, 16), New GooglePoint(16, 16))
Map.Icons.Add(ic1)
For Each masterRow As System.Data.DataRow In dst1.Tables("tblDestinations").Rows()
destinationID = masterRow(
"DestinationID").ToString()
lat = masterRow(
"Latitude").ToString()
lng = masterRow(
"Longitude").ToString()
address = masterRow(
"Address1").ToString()
city = masterRow(
"City").ToString()
state = masterRow(
"State").ToString()
zip = masterRow(
"Zip").ToString()
tele = masterRow(
"Phone").ToString()
name = masterRow(
"DestinationName").ToString()
website = masterRow(
"website").ToString()
logo = masterRow(
"Logo").ToString()
Baloon =
"<table cellpadding=5 style=width: 356px; position: static; height: 68px><tr><td align=left rowspan=2 valign=middle><img src=" & logo & " style=width: 88px; position: static; height: 90px /></td><td align=left rowspan=2 style=width: 353px valign=middle><strong>" & name & "<br /></strong>" & address & "<br />" & tele & "<br /><a href=http://" & website & " target=_blank >More Info </a><br /></td></tr><tr></tr></table>"
Dim DestEvent As New Reimers.Map.GoogleMarkerOptions
DestEvent.Clickable =
True
DestEvent.Title = masterRow(
"DestinationName").ToString()
Dim MyMarker = New Reimers.Map.GoogleMarker(name, lat, lng, New GoogleMarkerOptions(ic1))
MyMarker.MarkerText = Baloon
Map.Overlays.Add(MyMarker)
Next
Map.PostRenderScript = Map.ZoomToBounds(Map.Overlays.Bounds)
End Sub
Protected Sub Map_MarkerClick(ByVal Map As Reimers.Map.GoogleMap, ByVal Marker As GoogleOverlay, ByRef MapCommand As String)
If TypeOf Marker Is GoogleMarker Then
Dim m As GoogleMarker = CType(Marker, GoogleMarker)
MapCommand = m.OpenInfoWindowHTML(Map,
"<div>" + m.MarkerText + "</div>")
Else
End If
End Sub
Protected Sub Map_Click(ByVal Map As Reimers.Map.GoogleMap, ByVal Point As GoogleLatLng, ByRef MapCommand As String)
MapCommand = Map.OpenInfoWindowHTML(Point,
"Lat: " + Point.Latitude.ToString + "<br />Lng: " + Point.Longitude.ToString)
End Sub
Function ClientGeocoder1_ClientGeocoded(ByVal Position As Reimers.Map.GoogleLatLng, ByVal IP As String) As String
Dim l As Reimers.Map.Geocoding.Location = Reimers.Map.Geocoding.GoogleGeocoder.ReverseGeocode(Position)
Dim gm As GoogleMarker = New GoogleMarker(DateTime.Now.Millisecond.ToString, l.Point)
gm.MarkerText =
String.Format("<p><strong>Nearest Location</strong></p><p>{0}, {1}</p>", l.Address.City, l.Address.Country)
gm.ClientSideHandlers.OnClick = gm.OpenInfoWindowHTML(Map, gm.MarkerText)
Return Map.AddOverlay(gm) + Map.CenterAndZoom(Position, 8) + Map.OpenInfoWindowHTML(Position, String.Format("Your IP address ({0}) is registered here.", IP))
End Function
Function Sidebar_MouseOut(ByVal Item As GoogleOverlay) As String
Return Map.CloseInfoWindow
End Function
Function Sidebar_Click(ByVal Item As GoogleOverlay) As String
If TypeOf Item Is GoogleMarker Then
Dim m As GoogleMarker = CType(Item, GoogleMarker)
Return m.OpenInfoWindowHTML(Map, m.MarkerText)
Else
Return Nothing
End If
End Function