VDS Technologies

 

Remove Marker Specifict Marker

12/31/2014 5:38:19 AM
Total Posts 50

Remove Marker Specifict Marker

Hi. I have problem to remove Marker when using Checkbox button. How to remove Marker for specifict marker? I tried to use Map.marker.clear() , it is clear all marker. i need only remove/clear Marker which is uncheckbox action. And I tried to use map.Markers.Remove("markerTanks") but error : Exception Details: System.FormatException: Input string was not in a correct format. My Code like this : If CheckBoxTanks.Checked = "true" Then Dim pointData As PointDataLayer pointData = New PointDataLayer(providerName, strConnString, tableName, "Lat", "Lon") layerDB = map.AddLayer(pointData) 'layerDB.UseDefaultSymbol = False Dim rscst As Recordset = layerDB.SearchShape(map.Extent, AspMap.SearchMethod.Inside) 'map.Markers.Clear() map.Callouts.Clear() Do While Not rscst.EOF Dim latLong As AspMap.Point = New AspMap.Point(rscst.Shape.GetPoint(0).X, rscst.Shape.GetPoint(0).Y) Dim image As MarkerSymbol = New MarkerSymbol("Symbol/yagura3_hot_spring_tower.png", 22, 22) Dim markerTanks As AspMap.Web.Marker = New Marker(latLong, image, rscst("Name").ToString) map.Markers.Add(markerTanks) Dim callout As Callout = map.Callouts.Add() callout.X = latLong.X callout.Y = latLong.Y callout.Text = rscst("Name").ToString callout.Font.Size = 15 callout.BackColor = Color.Green rscst.MoveNext() Loop Else map.Markers.Remove("markerTanks") map.Callouts.Clear() End If
1/2/2015 5:20:01 AM
MVP
Total Posts 323

Re: Remove Marker Specifict Marker

The Markers collection has two methods, Marker.Remove(Marker marker) and Marker.Remove(int markerIndex).

None of these methods accept strings.

1/3/2015 9:15:12 AM
Total Posts 33

Re: Remove Marker Specifict Marker

hi,

maybe its works for you, 

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

If (CheckBoxTanks.Checked) Then

' Call Method Marker

Marker()

End If

End Sub

Private Sub Marker()
Dim pointData As PointDataLayer
pointData = New PointDataLayer(providerName, strConnString, tableName, "Lat", "Lon")
layerDB = Map.AddLayer(pointData)
'layerDB.UseDefaultSymbol = False
Dim rscst As Recordset = layerDB.SearchShape(Map.Extent, AspMap.SearchMethod.Inside)
'map.Markers.Clear()
Map.Callouts.Clear()
Do While Not rscst.EOF
Dim latLong As AspMap.Point = New AspMap.Point(rscst.Shape.GetPoint(0).X, rscst.Shape.GetPoint(0).Y)
Dim image As MarkerSymbol = New MarkerSymbol("Symbol/yagura3_hot_spring_tower.png", 22, 22)
Dim markerTanks As AspMap.Web.Marker = New Marker(latLong, image, rscst("Name").ToString)
Map.Markers.Add(markerTanks)
Dim callout As Callout = Map.Callouts.Add()
callout.X = latLong.X
callout.Y = latLong.Y
callout.Text = rscst("Name").ToString
callout.Font.Size = 15
callout.BackColor = Color.Green rscst.MoveNext()
Loop
End Sub

1/4/2015 11:20:49 PM
Total Posts 50

Re: Remove Marker Specifict Marker

Thank you sir. Now it is works.