ArcGIS Add graphics
ArcGIS_AddGraphics_VBNet\Default.aspx.vb
' Copyright 2010 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See the use restrictions.
' 


Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ScriptManager1.RegisterAsyncPostBackControl(ClearGraphicsButton)
    End Sub

    Protected Sub ClearGraphicsButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ClearGraphicsButton.Click
        ' Get the ArcGIS Server specific MapFunctionality.  This MapFunctionality is shared between Internet and 
        ' Local resource types
        Dim agsMapFunctionality As ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality = CType(Map1.GetFunctionality("MapResourceItem0"), ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)

        ' the state of ArcGIS Server specific content for a map resource is maintained in an ArcGIS Server SOAP API 
        ' MapDescription. The MapDescription.CustomGraphics property is used to define an array of SOAP API graphic 
        ' elements to draw on the map generated by the map server.   In this case, we set this property to null, 
        ' effectively clearing these graphic elements.
        Dim mapDescription As ESRI.ArcGIS.ADF.ArcGISServer.MapDescription = agsMapFunctionality.MapDescription
        mapDescription.CustomGraphics = Nothing

        ' Refresh the map and return callback results to apply the updates.
        Map1.Refresh()
        ScriptManager1.RegisterDataItem(Page, Map1.CallbackResults.ToString(), False)
    End Sub
End Class