Common Partial postback
Common_PartialPostback_CSharp\App_Code\CustomTool.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.
// 

namespace CustomTools
{
    // Centers the map control at the point specified by the passed-in argumetns
    public class CustomCenterTool : ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools.IMapServerToolAction
    {
        #region IMapServerToolAction Members

        void ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools.IMapServerToolAction.ServerAction(
            ESRI.ArcGIS.ADF.Web.UI.WebControls.ToolEventArgs toolEventArgs)
        {
            // Get a reference to the Web ADF Map control that was clicked
            ESRI.ArcGIS.ADF.Web.UI.WebControls.Map adfMap =
                (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)toolEventArgs.Control;

            // Cast the passed-in arguments to PointEventArgs for referencing the click point
            ESRI.ArcGIS.ADF.Web.UI.WebControls.PointEventArgs pointEventArgs =
                toolEventArgs as ESRI.ArcGIS.ADF.Web.UI.WebControls.PointEventArgs;

            // Center the map at the click point
            if (adfMap != null && pointEventArgs != null)
                adfMap.CenterAt(pointEventArgs.ScreenPoint);
        }

        #endregion
    }

}