--How to setup and run
1. Unzip the sample. One project is included, the ZoomToScaleWebSite.
2. In Visual Studio 2005, open the ESRI.ADF.Samples.ZoomToScaleWebSite.sln.
3. The Web site contains the following:
a) Default.aspx - Web page containing two Web ADF MapResourceManagers, two Maps, a Toolbar, a set of buttons and a custom
User control (GoToLocation.ascx). The MapResourceManager\Map combinations illustrate the difference betwen a cached and non-cached
primary map resource. A set of buttons switch between cached and non-cached (dynamic).
b) ZoomToScale.ascx - Custom User control which contains a panel a textbox, button, and select box. The textbox contains the current
scale value for a map with a dynamic map resource. You can enter an explicit value in the textbox and click the Zoom button to zoom to the
defined extent. When a cached primary map resource is used, the select box lists the available scale levels. To zoom to a scale, select a level.
c) ZoomToScale.js - JavaScript file to calculate the map scale value.
4. With the page in design view, select the ZoomToScale User control and note the following properties:
a) If the map control Id is not the default ("Map1"), change the MapId property to the correct one.
b) By default, the control will try to get the type of units used by the Map control.
You can explicitly define this by changing the MapUnits property.
5. Build and run the application.
a) Click on the Cached Resource button at the bottom of the page.
b) By default, an ArcGIS Online service is displayed. Select a scale value and the map will zoom to it.
c) Click on the Dynamic Resource button.
d) By default, a ArcGIS samples server service is displayed. Note the scale value is displayed in the ZoomToScale
User control textbox. Enter a new value in the textbox and click the Zoom button. The map should zoom to the defined scale.
--How to add to a Web Mapping Application
1. Add the ZoomToScale folder to the root of the WMA Web site (refresh Solution Explorer to see the folder in Visual Studio).
2. Drag the ZoomToScale user control into the same cell as the Toolbar (a table data element <td> with the id "ToolbarCell").
Place it to the left of the Toolbar.
3. Set the following properties on the ZoomToScale user control:
Map = Map1
MapUnits = Resource_Default
The Resource_Default setting will use the map units of the Primary Map Resource.
4. Run the application. If a cached service is the Primary Map Resource, select from the drop down of valid scale levels.
If a non-cached service, enter a scale to zoom to.
--Special requirements\notes
1. Controls are registered in the web.config (<pages><controls> section) instead of the page. This technique enables you
to add multiple pages in the same site without explicitly registering controls in each page.
2. The ZoomToScale functionality is tied to a Map control and limited to only one per Map control.
There can be multiple Map controls on the page, each with their own ZoomToScale user control.