Developing Web Applications with the Web ADF  

Creating a Web application with Web controls

 

The Web ADF includes a set of predefined controls add to exising Web applications or create new Web applications quickly and efficiently.   The Web ADF controls are integrated with the visual design-time environment provided by Visual Studio 2005.  This example shows you how to create a Web application from scratch using the Web ADF controls.
 
  1. Start Visual Studio 2005 and create a new project.  Click the file menu, click New, and select Web Site.
  2. In the New Web Site dialog, set the Location value to HTTP, and Language to your language of choice.
  3. Under Visual Studio installed templates, click ASP.NET Web Site.


  4. Enter a name and location for the Web application and click OK.  Visual Studio 2005 should show a blank Default.aspx page in design view.   
  5. Open the Visual Studio Toolbox and expand the ArcGIS Web Controls tab.  Drag a MapResourceManager control and a Map control onto the Default.aspx page. 
  6. Set the ResourceItems property on the MapResourceManager control.  Click the "Edit Map Resources" verb on the control in the design view -or- in the MapResourceManager property page click the ellipsis next to the ResourceItems property to display the MapResourceInfo Collection Editor dialog.
      
  7. In the MapResourceItem Collection Editor dialog, add a new MapResourceItem (click the Add button).  Set its Definition property by clicking the ellipsis in the property page to display the Map Resource Definition Editor.  Select a resource type and define the appropriate properties.  See the Add Resources section in the MapResourceManager control topic for more detailed information.  In general, you can use any resource type that generates a map image.  Close the MapResourceItem Collection Editor.
  8. Set the MapResourceManager property on the Map control.  Select the Map control in design view or in the Properties window, then click the dropdown list for the MapResourceManager property.  Select the name of the MapResourceManager added in a previous step (by default "MapResourceManager1").
  9. Change the size of the Map control to at least 300x300 pixels.  This is not required, but will make the Map easier to visualize on the page. 
  10. Add a Toc control to the Default.aspx page. 
  11. Change the positioning of the control to be absolute, which will enable the control to be placed anywhere on the page.  By default, Visual Studio 2005 adds controls in flow layout.  Right-click the Toc control and select "Style".    In the Style Builder dialog, select the Position option and click the dropdown list under "Position Mode".  Select "Absolutely position" and click OK to exit the dialog.  Select the Toc control in design view and start to drag it to another location on the page.  Note that it will immediately display in the upper left corner of the page.  This is default behavior associated with Web control positioning in Visual Studio 2005.  Select the Toc control again and drag it to the right of the Map control.
     
  12. Set the Map property on the Toc control.  Select the Toc control in design view or in the Properties window, then click the dropdown list for the Map property.  The list will include the names of Map controls available on the page.  Select the name of the Map control added in a previous step (by default "Map1").  This will buddy the Toc with the Map control.
  13. Add a Toolbar control to the Default.aspx page. 
  14. Set the BuddyControls property on the Toolbar control. Select the Toolbar control in design view or in the Properties window, then click the ellipsis for the BuddyControls property.  In the BuddyControl Collection Editor dialog, add a new item and set its Name property to the name of the Map control added in a previous step (by default "Map1").  
  15. Set the ToolbarItems property on the Toolbar control.  Select the Toolbar control in design view or in the Properties window, then click the ellipsis for the ToolbarItems property.  In the ToolbarItems Collection Editor dialog, add all tools under the "Navigation Tools" node.  See the Add Toolbar Items section in the Toolbar control topic for more detailed information.  Click OK to exit the editor dialog and save all changes to the Web site.  In design view, the site should appear as follows:


  16. Click the Start button to run the application.
  17. Explore the interface of your Web application.  For example, click the Zoom In tool on the toolbar and drag a rectangle over the map. 
  18. Click the Stop button to stop the application or the close the browser window.