Markers


 

 

Adding a simple marker with a tooltip

 

This sample demonstrates how to add a Marker with a default image. The marker has a tooltip which will be displayed when the mouse pointer is over the marker's image.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Map1.AddLayer(MapPath("states.shp"))

        If (Not IsPostBack) Then
                Dim marker As Marker = New Marker(New AspMap.Point(-104.59, 39.44), "Denver")
                Map1.Markers.Add(marker)
        End If
End Sub

 

 

Adding a simple marker with HTML content

 

This sample demonstrates how to add a Marker with HTML content which will be displayed when the user clicks on the marker.


Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Map1.AddLayer(MapPath("states.shp"))

        If (Not IsPostBack) Then
                Dim marker As Marker = New Marker(New AspMap.Point(-104.59, 39.44), "Denver", "Denver<br>Colorado<br>USA")
                Map1.Markers.Add(marker)
        End If
End Sub

 

 

Adding a marker with a custom image

 

This sample demonstrates how to add a Marker with a custom MarkerSymbol (a GIF image).
 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Map1.AddLayer(MapPath("states.shp"))

        If (Not IsPostBack) Then
                MarkerSymbol symbol = new MarkerSymbol("symbols/marker1.gif", 19, 31);
                Marker marker = new Marker(new AspMap.Point(-104.59, 39.44), symbol, "Denver");
                Map1.Markers.Add(marker);
        End If
End Sub

 

 

Adding a server-side clickable marker

 

This sample demonstrates how to add a clickable Marker. It adds an event handler to the MarkerClick event of the server-side Map control to handle clicks on the sever side.
 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Map1.AddLayer(MapPath("states.shp"))

        If (Not IsPostBack) Then
                Dim marker As Marker = New Marker(New AspMap.Point(-104.59, 39.44), "Denver")
                marker.Clickable = True
                marker.Argument = "Denver"
                Map1.Markers.Add(marker)
        End If
End Sub

Protected Sub Map1_MarkerClick(ByVal sender As Object, ByVal e As MarkerClickEventArgs) Handles Map1.MarkerClick
        Dim marker As Marker = Map1.Markers(e.MarkerIndex)
        String argument = marker.Argument
End Sub

 

Adding a client-side clickable marker

 

This sample demonstrates how to add a clickable Marker. It adds an event handler to the markerClick event of the client-side Map control to handle clicks on the client side.
 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Map1.AddLayer(MapPath("states.shp"))

        If (Not IsPostBack) Then
                Dim marker As Marker = New Marker(New AspMap.Point(-104.59, 39.44), "Denver", "Denver, Colorado")
                marker.Clickable = True
                marker.Argument = "Denver"
                Map1.Markers.Add(marker)
        End If
End Sub

<script type="text/javascript">

var map = AspMap.find('<%=Map1.ClientID%>');

function onMarkerClick(sender, e /* MarkerClickEventArgs */)
{
        alert(e.argument + "\n" + e.content);
        return true;
}
map.add_markerClick(onMarkerClick);

</script>     

 

© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)