Hiding / Showing Markers on the client?

Aug 23, 2010 at 4:11 PM

Hello All.

Is it possible to show / hide makers on the client without having to round trip?

 

Cheers peeps.

Aug 25, 2010 at 4:54 AM

You can try adding them or removing:

 

<asp:Button runat="server" Text="Load" OnClick="HandleLoadClick" />
    <artem:GoogleMap ID="GoogleMap1" runat="server" Width="634px" Height="600px" Latitude="42.1229"
        Longitude="24.7879" Zoom="4" EnableScrollWheelZoom="true" OnClientClick="addMarker">
        <Markers>
            <artem:GoogleMarker Latitude="42.1229" Longitude="24.7879" Title="Click on the marker"
                Text="Text of marker 1" Draggable="true">
            </artem:GoogleMarker>
            <artem:GoogleMarker Latitude="42.1229" Longitude="20." Title="Click on the marker"
                Text="Text of </b>marker</b> 2" Draggable="true">
            </artem:GoogleMarker>
        </Markers>
    </artem:GoogleMap>

 

   function addMarker(overlay, point) {
            if (point) {
                // Notice the usage of the second parameter with value true.
                // That will force the marker to be render to the map while adding it.
                // The second line, which is commented now, is no longer needed
                GoogleMap1.clearMarkers();
                GoogleMap1.addMarker({ Latitude: point.lat(), Longitude: point.lng(), Draggable: true }, true);


            }
        }

 

Found the clearMarkers() method by going through GoogleMap-4.1.js