ArcGIS_AddGraphics_CSharp\Default.aspx.cs
// 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. // using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ScriptManager1.RegisterAsyncPostBackControl(ClearGraphicsButton); ClearGraphicsButton.Click +=new System.EventHandler(ClearGraphicsButton_Click); } protected void ClearGraphicsButton_Click(object sender, System.EventArgs e) { // Get the ArcGIS Server specific MapFunctionality. This MapFunctionality is shared between Internet and // Local resource types ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality agsMapFunctionality = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)(Map1.GetFunctionality("MapResourceItem0")); // 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. ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDescription = agsMapFunctionality.MapDescription; mapDescription.CustomGraphics = null; // Refresh the map and return callback results to apply the updates. Map1.Refresh(); ScriptManager1.RegisterDataItem(Page, Map1.CallbackResults.ToString(), false); } }