ArcGIS Go to Scale Tool

Go to Scale Tool/textbox

/* This code snippet gets the new scale from the textbox control object to calculate the zoom factor. It also calculates the map center as a web adf point and supplies that to the Map.Zoom method to change the scale appropriately.*/

protected void Text_Scale_TextChanged(object sender, EventArgs e)

{

double xmin = Map1.Extent.XMin;

double ymin = Map1.Extent.YMin;

double currentEnvelopewidth = Map1.Extent.Width;

double currentEnvelopeHeight = Map1.Extent.Height;

double currentMapCenterX = xmin + (currentEnvelopewidth / 2);

double currentMapCenterY = ymin + (currentEnvelopeHeight / 2);

double zoomfactor = 1;

System.Web.UI.WebControls.TextBox tb = (System.Web.UI.WebControls.TextBox)sender;

double newscale = Convert.ToDouble(tb.Text);

zoomfactor = mapOriginalScale / newscale;

ESRI.ArcGIS.ADF.Web.Geometry.Point adfPoint = new ESRI.ArcGIS.ADF.Web.Geometry.Point();

adfPoint.X = currentMapCenterX;

adfPoint.Y = currentMapCenterY;

Map1.Zoom(zoomfactor, adfPoint);

}