How to use
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.
At design time
- Verify that the Web ADF for the .NET Framework is installed and functioning properly. For information on installing and configuring the Web ADF, consult the installation guide.
- In Windows Explorer, navigate to <ArcGIS Developer Kit install location>\Samples\ServerNET. This folder contains the Common_MapTips CSharp and VBNet folders.
- Open the folder of the language you are going to use (that is, CSharp or VBNet) and copy the Common_MapTips_<language> folder to c:\inetpub\wwwroot. The <language> variable can be CSharp or VBNet.
- Open the IIS Manager from Control Panel, Administrative Tools, Internet Information Services (IIS) Manager, or Internet Information Services.
- In the console tree view on the left, navigate to Local Computer, Web Sites, Default Web Site. Expand Default Web Site. Right-click the Common_MapTips_<language> folder and click Properties. The Properties dialog box appears.
- Click the Directory tab, click the Create button in the Application Settings section, then click OK to close the Properties dialog box.
- Start Visual Studio 2010 and open the solution file for the Common_MapTips_CSharp sample Common_MapTips_CSharp2010.sln located in the c:\inetpub\wwwroot\Common_MapTips_CSharp folder.
- In the Solution Explorer, right-click the page you want to view, and select Set As Start Page.
- The pages in this sample are configured to use the USA map service, and it is assumed that this service is running on the local machine (localhost). You can create this service by publishing the map document located at <ArcGIS Developer Kit install location>\Samples\data\Usa\USA.mxd. For instructions on how to publish a map document to ArcGIS for Server, see the topic "Publishing a GIS resource to the server" in the ArcGIS for Server Help. Using a map service other than USA, requires modifying the sample code, as some pages specify an extent based on this data and others assume the presence of particular attributes.
- If the USA service is not running on the local machine, you must specify the proper location by opening the page you want to view, opening the properties window for the MapResourceManager control, then clicking the ellipsis next to the ResourceItems property. The ResourceItem Collection Editor dialog box appears.
- Click the ellipsis next to the Definition property. The Map Resource Definition Editor dialog box appears.
- In the Data Source field, replace localhost with the name of the machine hosting the USA service.
- Save the project.
- Click the Debug drop-down menu and click Start Debugging.
At run time
- Browse to the application uniform resource locator (URL), for example, http://localhost/Common_MapTips_CSharp, or start the application from Visual Studio.
- Interact with each .aspx page as described in the following sections.
CustomFormat_Server.aspx and CustomFormat_Client.aspx
- Move the mouse pointer over a city feature. The MapTips title is formatted as specified in the sample code.
- Click the MapTip to expand it. As with the title, the MapTips content is formatted as specified in the sample code.
JavaScriptFormatting.aspx
- Move the mouse pointer over a county feature.
- Click the MapTip that appears. The first value, which was dynamically calculated via the JavaScript specified in the sample code, matches the second value, which was populated from the feature's data.
ConditionalFormatting.aspx
- Move the mouse pointer over a county feature.
- Click the MapTip that appears. Depending on the county's population density, the background of the MapTip is red, yellow, or green.
SetMapTipsWidth.aspx
- Move the mouse pointer over a city feature and click the MapTip that appears (note the width of the expanded MapTip).
- In the text box below the map, type a new width for the MapTips and click Update MapTips Width (note that the width is in pixels).
- Move the mouse pointer over a city feature again and click the MapTip that appears. The typed width has been applied.
CustomDefaultLayout.aspx
- Move the mouse pointer over a city graphic feature (symbolized by a blue star). The MapTip shown has a custom layout.
- Move the mouse pointer over a highway feature. The MapTip shown has the same custom layout because a custom default layout has been specified programmatically.
- Execute the page's QueryAttributesTask. The custom default layout also applies to the MapTips for the task results.
MultipleCustomLayouts.aspx
- Move the mouse pointer over a city graphic feature (symbolized by a blue star). The MapTip shown has a custom layout.
- Move the mouse pointer over a highway feature. The MapTip shown has a different custom layout because distinct layouts for the two graphics layers have been specified in the code.
SetMapTipsLayer.aspx
- Select a layer from the drop-down menu below the map.
- Once the map is refreshed, MapTips are shown for the selected layer.
ShowOnlyOnClick.aspx
- Move the mouse pointer over a city feature. No MapTip displays.
- Click the city feature. The MapTip displays.
StickyMapTips.aspx
- Move the mouse pointer over a highway feature and click the MapTip that appears.
- Repeat Step 1 for several more highway features. When a new MapTip displays, the previously displayed MapTips remain visible.
- Click a MapTip that is obscured by another MapTip. The clicked MapTip moves to the front.
- Click the MapTip that you brought to the front. The MapTip closes.
CoincidentFeatureList.aspx
- Move the mouse pointer over a city feature that overlaps other city features. The names of all the overlapping cities are shown on the MapTip that appears.
- Click the MapTip to expand it. The overlapping features' attributes are shown in a list in the contents section.
AttributesOnDemand.aspx
- Click the Find button on the AttributesOnDemandTask.
- Hover over one of the results features and click the MapTip that appears. An activity indicator is shown while the feature's attributes are retrieved (this is replaced by the attributes once they are returned to the client).
CoincidentFeatureDropDown.aspx
- Move the mouse pointer over a city feature that overlaps other city features. The MapTip that appears has a drop-down menu and a close hyperlink at the top.
- Click the drop-down menu and select a different city. The MapTip updates to display the attributes of the selected city.
- Click the close hyperlink. The MapTip closes.
Additional information
The following is a brief description of the different manipulation techniques, listed in order of difficulty:
- CustomFormat_Server.aspx—Illustrates the Web-tier specification of the MapTip title and contents.
- CustomFormat_Client.aspx—Illustrates the client-tier specification of the MapTip title and contents.
- JavaScriptFormatting.aspx—Demonstrates how to embed JavaScript in the MapTip Contents property. Enables the creation of content that is dynamically calculated based on attributes of the feature for which a MapTip is shown.
- ConditionalFormatting.aspx—Demonstrates how to format a MapTip based on an attribute value of the graphic feature for which the MapTip is shown.
- SetMapTipsWidth.aspx—Demonstrates how to programmatically manipulate a MapTip's width.
- CustomDefaultLayout.aspx—Demonstrates how to define a custom default MapTips layout in code.
- MultipleCustomLayouts.aspx—Demonstrates how to programmatically define different MapTip layouts on different graphics layers.
- SetMapTipsLayer.aspx—Illustrates changing the layer for which MapTips are displayed at run time.
- ShowOnlyOnClick.aspx—Illustrates the use of event handling to implement MapTips that are shown only when a feature is clicked.
- StickyMapTips.aspx—Illustrates the creation of MapTips that remain open once they are expanded. This is done via extensive document object model (DOM) element manipulation and MapTips event handling. A MapTip that is obscured by other MapTips can be brought to the front by a single click, and closed by clicking again.
- CoincidentFeatureList.aspx—Demonstrates how to create MapTips that display a feature list when overlapping features are hovered over. This is accomplished by extending the Web ADF JavaScript Library's GraphicFeatureGroup to raise a coincidentFeaturesMouseOver event, then implementing a handler for this event.
- AttributesOnDemand.aspx—Illustrates modifying MapTips so that a feature's attribute data is retrieved only when a MapTip is expanded. This is done by the following:
- Extending the Web ADF JavaScript Library's GraphicFeatureGroup, GraphicFeature, and MapTips objects.
- Implementing a custom QueryAttributesTask that interacts with the JavaScript extensions.
- CoincidentFeatureDropDown.aspx—Demonstrates how to customize MapTips so that, when overlapping features are hovered over, the displayed MapTip contains a drop-down menu that allows you to select the overlapping feature with which to view attributes. Uses the same extensions as CoincidentFeatureList, adds extensive event handling, and DOM element manipulation.
Common_MapTips_CSharp\CustomFormat_Server.aspx | Formats MapTips content via Web-tier properties. |
Common_MapTips_CSharp\CustomFormat_Server.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\CustomFormat_Client.aspx | Formats MapTips content via client-tier properties. |
Common_MapTips_CSharp\CustomFormat_Client.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\JavaScriptFormatting.aspx | Formats MapTips content dynamically via JavaScript. |
Common_MapTips_CSharp\JavaScriptFormatting.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\ConditionalFormatting.aspx | Formats MapTips content based on attribute values. |
Common_MapTips_CSharp\ConditionalFormatting.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\SetMapTipsWidth.aspx | Specification of MapTips width. |
Common_MapTips_CSharp\SetMapTipsWidth.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\CustomDefaultLayout.aspx | Specification of a custom default MapTips layout. |
Common_MapTips_CSharp\CustomDefaultLayout.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\MultipleCustomLayouts.aspx | Specification of different custom MapTips layouts on different graphics layers. |
Common_MapTips_CSharp\MultipleCustomLayouts.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\SetMapTipsLayer.aspx | Changes the MapTips layer at run time. |
Common_MapTips_CSharp\SetMapTipsLayer.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\App_Code\MapTipsLayerMenu.cs | Contains the implementation of the DropDownBox ServerAction. Updates the MapTips when a new layer is selected. |
Common_MapTips_CSharp\ShowOnlyOnClick.aspx | Implements MapTips that are only shown when a GraphicFeature is clicked. |
Common_MapTips_CSharp\ShowOnlyOnClick.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\StickyMapTips.aspx | Implements MapTips that remain open when other MapTips are shown. |
Common_MapTips_CSharp\StickyMapTips.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\CoincidentFeatureList.aspx | Implements MapTips that display a feature list when overlapping features are hovered over. |
Common_MapTips_CSharp\CoincidentFeatureList.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\JavaScript\CoincidentFeatureFunctions.js | JavaScript file containing extensions to GraphicFeatureGroup. |
Common_MapTips_CSharp\AttributesOnDemand.aspx | Implements MapTips that retrieve a feature's attributes only when the MapTip for that feature is expanded. |
Common_MapTips_CSharp\AttributesOnDemand.aspx.cs | Code behind the .aspx page. |
Common_MapTips_CSharp\JavaScript\AttributesOnDemand.js | JavaScript file containing extensions to GraphicFeatureGroup, GraphicFeature, and MapTips. |
Common_MapTips_CSharp\App_Code\AttributesOnDemandTask.cs | Contains the implementation of custom QueryAttributesTask. |
Common_MapTips_CSharp\CoincidentFeatureDropDown.aspx | Implements MapTips that display a MapTip containing a feature selection drop-down menu when overlapping features are hovered over. |
Common_MapTips_CSharp\CoincidentFeatureDropDown.aspx.cs | Code behind the .aspx page. |
Common_MapTips_VBNet\CustomFormat_Server.aspx | Formats MapTips content via Web-tier properties. |
Common_MapTips_VBNet\CustomFormat_Server.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\CustomFormat_Client.aspx | Formats MapTips content via client-tier properties. |
Common_MapTips_VBNet\CustomFormat_Client.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\JavaScriptFormatting.aspx | Formats MapTips content dynamically via JavaScript. |
Common_MapTips_VBNet\JavaScriptFormatting.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\ConditionalFormatting.aspx | Formats MapTips content based on attribute values. |
Common_MapTips_VBNet\ConditionalFormatting.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\SetMapTipsWidth.aspx | Specification of MapTips width. |
Common_MapTips_VBNet\SetMapTipsWidth.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\CustomDefaultLayout.aspx | Specification of a custom default MapTips layout. |
Common_MapTips_VBNet\CustomDefaultLayout.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\MultipleCustomLayouts.aspx | Specification of different custom MapTips layouts on different graphics layers. |
Common_MapTips_VBNet\MultipleCustomLayouts.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\SetMapTipsLayer.aspx | Changes the MapTips layer at run time. |
Common_MapTips_VBNet\SetMapTipsLayer.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\App_Code\MapTipsLayerMenu.vb | Contains the implementation of the DropDownBox ServerAction. Updates the MapTips when a new layer is selected. |
Common_MapTips_VBNet\ShowOnlyOnClick.aspx | Implements MapTips that are only shown when a GraphicFeature is clicked. |
Common_MapTips_VBNet\ShowOnlyOnClick.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\StickyMapTips.aspx | Implements MapTips that remain open when other MapTips are shown. |
Common_MapTips_VBNet\StickyMapTips.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\CoincidentFeatureList.aspx | Implements MapTips that display a feature list when overlapping features are hovered over. |
Common_MapTips_VBNet\CoincidentFeatureList.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\JavaScript\CoincidentFeatureFunctions.js | JavaScript file containing extensions to GraphicFeatureGroup. |
Common_MapTips_VBNet\AttributesOnDemand.aspx | Implements MapTips that retrieve a feature's attributes only when the MapTip for that feature is expanded. |
Common_MapTips_VBNet\AttributesOnDemand.aspx.vb | Code behind the .aspx page. |
Common_MapTips_VBNet\JavaScript\AttributesOnDemand.js | JavaScript file containing extensions to GraphicFeatureGroup, GraphicFeature, and MapTips. |
Common_MapTips_VBNet\App_Code\AttributesOnDemandTask.vb | Contains implementation of custom QueryAttributesTask. |
Common_MapTips_VBNet\CoincidentFeatureDropDown.aspx | Implements MapTips that display a MapTip containing a feature selection drop-down menu when overlapping features are hovered over. |
Common_MapTips_VBNet\CoincidentFeatureDropDown.aspx.vb | Code behind the .aspx page. |
Download the files for all languages