Marker Viewstate,Centering the map and a custom class implementing ITemplate is used for display in the infowindow.

Oct 15, 2008 at 6:02 PM

Hello. First let me say that this control is awsome!

I am building an application which plots points on the map with a custom icon and populates the infowindow with data from a database.  I am implimenting the template class for the infowindow.
What I need assistance with is re-centering the map on another location - and keeping all the marker data including the infowindow contents.
Im not sure whats wrong with my code, but when i "fly to" another location (that is, I re-centre the map), all of the points have the same info in the infowindow.

Here is my code:

Public Sub BuildMapFLyTo(ByVal Latitude As String, ByVal Longitude As String, ByVal osites As MyData.SiteSet, ByVal Zoomlevel As Integer)

        With GoogleMap1

            .Zoom = ZoomLevel
            .ShowTraffic = False
            .ShowMapTypeControl = True
            .EnableGoogleBar = False
            .ZoomPanType = Artem.Web.UI.Controls.ZoomPanType.Small
            .Latitude = Latitude
            .Longitude = Longitude
            .DefaultMapView = Artem.Web.UI.Controls.GoogleMapView.Normal
            .EnableInfoWindow = True
          

         

            .Key = "[MYKEY]"
            .EnableScrollWheelZoom = True

 

        End With
        '************get this to work
        GoogleMap1.Markers.LoadViewState(GoogleMap1.Markers)
        GoogleMap1.Markers.TrackViewState()
        'GoogleMap1.Markers.Clear()

        For Each omarker As Artem.Web.UI.Controls.GoogleMarker In GoogleMap1.Markers

            Dim oSize As New Artem.Web.UI.Controls.GoogleSize
            oSize.Height = 16
            oSize.Width = 23
            'oPlace = New Artem.Web.UI.Controls.GoogleLocation(oSite.ProjectLat, oSite.ProjectLong)
       

            omarker.IconSize = oSize
            omarker.IconAnchor = New Artem.Web.UI.Controls.GooglePoint(oSize.Width / 2, oSize.Height)
            omarker.InfoWindowAnchor = New Artem.Web.UI.Controls.GooglePoint(oSize.Width / 2, 2)
            omarker.ImageUrl = "Images/my_custom_transparent.png"
            For Each osite As MyData.Site In osites
                Dim tmp As New MyTemplate(osite)
                omarker.InfoWindowContent = tmp
               

            Next

        Next

    End Sub


Am I missing something obvious?!

Coordinator
Oct 16, 2008 at 6:17 AM
Edited Oct 16, 2008 at 6:19 AM

I cannot see anything obviously missing.
Just couple suggestion:

Check out if by any chance you haven't marked your ITemplate implamentation MyTemplate with
[TemplateInstance(TemplateInstance.Single)]
If so, remove it or change it to:
[TemplateInstance(TemplateInstance.Multiple)]

Take a close look the your ITemplate implementation.

Regards