ArcGIS Current Map Scale Readout

Current Map Scale Readout

/* In this code snippet, the new scale of the map is captured from the event arguments of the Map_ScaleChanged event and displayed in a label control. Callback framework is used to rewrite the label control without a postback.*/

protected void Map1_ScaleChanged(object sender, ScaleEventArgs args)

{

Label_Scale.Text = ((int)args.NewScale).ToString();

string returnstring = string.Empty;

using (System.IO.StringWriter sw = new System.IO.StringWriter())

{

HtmlTextWriter htw = new HtmlTextWriter(sw);

Label_Scale.RenderControl(htw);

htw.Flush();

returnstring = returnstring + sw.ToString();

}

 

CallbackResult cr = new CallbackResult(Label_Scale, “content”, returnstring);

Map1.CallbackResults.Add(cr);

}