



The Fields tab displays the fields in the MapTips layer and defines the
field visibility and field name displayed in the map tip callout
window. The check box next to each field can be used to set the
field visibility. You can also edit the text in the Alias field if
you do not want to use the original field name.
The primary display field is often used to describe the contents of a
record. In general, it is set to a field that contains an
intuitive, preferrably unique value to identify an attribute. You can
select the primary display field using the drop down box next to "Primary
display field".
The default values in the Fields tab reflect the field aliases,
visibility and primary display field that you set in the configuration file (
e.g. map document -.mxd) for the map service. The values
entered in this dialog will only override these settings in the
current Web application. If you want the fields to appear the
same way in multiple Web applications, consider setting the field properties in
the map service configuration file instead of resetting them in each Web
application.

Records
The Records tab displays the tabular format of MapTips as displayed in the
callout within the browser at runtime. By default, visible
fields are included in the record display as name value pairs and the
title is the primary display field. To customize the look and feel
of record display, select the Custom Formatting radio button. The Title
and Contents sections of the dialog are now editable. The Contents
section provides a rich text editor to modify font style and color or add
fields, hyperlinks, tables or images. Edits are stored as HTML style
content to be rendered in the browser at runtime. Note, the fields whose
values will be displayed in the title and content of the MapTip
callout are included in brackets "{<field name>}".

The Rich Text toolbar contains a set of tools to enhance how records are
displayed in the MapTips callout window. The following diagram
indicates the title of each tool.

The font style settings enable you to modify text within the contents
display. The Add Field tool provides a list of fields in the MapTips
layer which can be added to the contents display. The Add Hyperlink
tool will add a hyperlink to selected text or a field
values. Add Table will add an HTML table to the contents display
which can be used to better organize content. The Add Image tool
will add an image tag and enable you to define the url to an image. The
url may be constructed from a field value.
To view the HTML content that will be used to format layer results, select the
HTML radio button at the bottom of the dialog. The raw HTML content will
be displayed in the Content window. Any valid content to be rendered in a
browser can be added - this includes HTML, CSS definitions, and
JavaScript. See the Setting Title and Contents using HTML discussion
topic below for more information.
After setting the MapTips layer format via the expression, click OK to close
the dialog and save the settings. The layer format will be
saved as a JSON formatted string to the Layer property on the MapTips
control.

The following table provides a list of properties of interest. For
complete reference information, see the MapTips control in the library
reference section.
| Property Name | Type | Description |
|---|---|---|
| FeatureLimit | int | Maximum number of maptips displayed on the Map at a given time. This value may be limited by the service underlying the map resource. For example, by default ArcGIS Server map services are limited to returning 500 features at a time. To change this value, modify the MaxRecordCount property in the service configuration file (.cfg). For more information, see the Service configuration files topic in the ArcGIS Server administration help system. |
| Layer | string | Layer, along with MapResourceManager and Resource for which maptips are displayed. |
| Map | string | ID of the Map control in which the map tips are displayed. |
| ShowOnlyWhenLayerIsVisible | bool | Whether to display maptips only when the layer is visible, and not when the layer is turned off or invisible due to scale factor settings. |
| WhereClause | string | Displays maptips only for features matching the expression. |


A
MapTip Layout is the portion of a MapTip that contains its title and content. A
Layout consists of three components:
<div class="MapTipsStyle" style="width:{@callout_width}; position:relative;">
<div id="{@maptip_titleID}" class="title">
{@title}
</div>
<div id="{@maptip_contentID}" class="content">
{@content}
</div>
</div>
<style type="text/css">
.MapTipsStyle { background-image:url(Images/BlueShadow.png);
font-family:verdana; }
.MapTipsStyle .title { font-size:10pt; font-weight:bolder; }
.MapTipsStyle .content { font-size:8pt; }
</style>
A
custom MapTips Layout must include an image that contains the arrows that will
attach to the MapTip’s body and point to the feature that the MapTip is
describing. Since Web ADF MapTips open to the left or right and expand up or
down, the MapTips control supports using up to four different arrows - one each
for when the MapTip’s anchor point is in the upper left, upper right, lower
left, and lower right positions. However, specifying four distinct arrows is
not required; where appropriate, the same arrow may be used for more than one
anchor point.
var layout = {
'template': null,
'templateUrl': 'Templates/MapTipsStyle1.htm',
'arrowUrl': 'Images/BlueShadow.png',
'arrowBounds': [
// startX,startY,width,height,offsetX,offsetY,bufferX,bufferY
[954, 921, 16, 16, -1, -7, 5, -7], // NW - Upper Left
[939, 921, 16, 16, -15, -7, 5, -7], // NE - Upper Right
[954, 921, 16, 16, -1, -23, 5, -7], // SW - Lower Left
[939, 921, 16, 16, -15, -23, 5, -7] // SE - Lower Right
]
};
The first array specifies the bounds for the upper left (NW) arrow, the second
specifies the upper right (NE) arrow, the third the lower left (SW), and the
fourth the lower right (SE). Each array of arrow bounds must specify eight
members. In order of specification, these are:
5) offsetX - offset of the arrow from the side of the MapTip
ESRI.ADF.UI.defaultMapTipsTemplate.set_layout(layout);
var graphicFeatureGroup = $find(‘graphicFeatureGroupID’); var mapTips = graphicFeatureGroup.get_mapTips(); mapTips.set_layout(layout);
ESRI.ArcGIS.ADF.Web.UI.WebControls.LayerFormat layerFormat =
ESRI.ArcGIS.ADF.Web.UI.WebControls.LayerFormat.FromMapResourceManager(
MapResourceManager1, MapTips1.ResourceName, MapTips1.LayerID);
MapTips1.LayerFormat = layerFormat;
[VB]Dim layerFormat As ESRI.ArcGIS.ADF.Web.UI.WebControls.LayerFormat = _
ESRI.ArcGIS.ADF.Web.UI.WebControls.LayerFormat.FromMapResourceManager( _
MapResourceManager1, MapTips1.ResourceName, MapTips1.LayerID)
MapTips1.LayerFormat = layerFormat
MapTips1.Layer = string.Format("{0}::{1}::{2}", MapResourceManager1.ID,
mapTipsResourceName, mapTipsLayerName);
[VB]MapTips1.Layer = String.Format("{0}::{1}::{2}", MapResourceManager1.ID, _
mapTipsResourceName, mapTipsLayerName)
// Refresh the MapTips control to commit the changes made to the control's state MapTips1.RefreshMapTips(); // Refresh the resource on which the MapTips are shown so that the resource picks up // the changes Map1.RefreshResource(MapTips1.ResourceName);[VB]
' Refresh the MapTips control to commit the changes made to the control's state MapTips1.RefreshMapTips() ' Refresh the resource on which the MapTips are shown so that the resource picks up ' the changes Map1.RefreshResource(MapTips1.ResourceName)
// Construct JavaScript to retrieve the Web ADF JavaScript objects associated with the
// MapTips control. Note this code assumes the graphicFeatureGroup, graphicFeatureArray,
// mapTips, and callout variables have already been declared via client tier JavaScript
string retrieveMapTipsJavaScript = @"
// Get the GraphicFeatureGroup on which MapTips are displayed. {0} will be replaced
// below with the GraphicFeatureGroup's ASP.NET AJAX component ID.
graphicFeatureGroup = $find('{0}');
// Get the GraphicFeatures contained in the GraphicFeatureGroup and put them in an
// array
for (var i = 0; i < graphicFeatureGroup.getFeatureCount(); i++)
graphicFeatureArray[i] = graphicFeatureGroup.get(i);
// Get the Web ADF JavaScript MapTips control
mapTips = graphicFeatureGroup.get_mapTips();
// Get the Web ADF JavaScript Callout defining the format of the MapTips
callout = mapTips.get_callout();";
// Insert the ASP.NET AJAX component ID of the MapTips' GraphicFeatureGroup
retrieveMapTipsJavaScript = string.Format(retrieveMapTipsJavaScript,
MapTips1.GraphicsLayerClientID);
[VB]' Construct JavaScript to retrieve the Web ADF JavaScript objects associated with the
' MapTips control. Note this code assumes the graphicFeatureGroup, graphicFeatureArray,
' mapTips, and callout variables have already been declared via client tier JavaScript
Dim retrieveMapTipsJavaScript As String = _
"// Get the GraphicFeatureGroup on which MapTips are displayed. {0} " + vbNewLine + _
"// will be replaced below with the GraphicFeatureGroup's ASP.NET " + vbNewLine + _
"// AJAX component ID. " + vbNewLine + _
"graphicFeatureGroup = $find('{0}'); " + vbNewLine + _
"// Get the GraphicFeatures contained in the GraphicFeatureGroup and" + vbNewLine + _
"// put them in an array" + vbNewLine + _
"for (var i = 0; i < graphicFeatureGroup.getFeatureCount(); i++)" + vbNewLine + _
" graphicFeatureArray[i] = graphicFeatureGroup.get(i); " + vbNewLine + _
"// Get the Web ADF JavaScript MapTips control" + vbNewLine + _
"mapTips = graphicFeatureGroup.get_mapTips();" + vbNewLine + _
"// Get the Web ADF JavaScript Callout defining the MapTips format" + vbNewLine + _
"callout = mapTips.get_callout();"
' Insert the ASP.NET AJAX component ID of the MapTips' GraphicFeatureGroup
retrieveMapTipsJavaScript = String.Format(retrieveMapTipsJavaScript, _
MapTips1.GraphicsLayerClientID);
At this point, the JavaScript needs to be sent to the client browser to be
executed. If the above code is executing during application startup, this can
be done using Page::ClientScript::RegisterStartupScript. If the code is
executing during an asynchronous callback or partial postback, the JavaScript
should be encapsulated in a Web ADF CallbackResult using the static method
CallbackResult.CreateJavaScript and added to the callback results collection of
the control that initiated the asynchronous request.
protected void Page_Load(object sender, EventArgs e)
{
// Add a handler to the map's ResourceRefreshed event
Map1.ResourceRefreshed += new MapResourceRefreshedEventHandler(Map1_ResourceRefreshed);
}
void Map1_ResourceRefreshed(object sender, ResourceRefreshedEventArgs args)
{
// Check whether the resource being refreshed includes the MapTips GraphicsLayer
if (args.MapResource.Name == "ESRI ADF Layer Map Tips")
{
// Construct JavaScript to re-initialize client-side MapTips properties
string reApplyMapTipsPropsJavaScript = "<initialization JavaScript>";
// Encapsulate the JavaScript in a CallbackResult
CallbackResult reApplyMapTipsPropsCallbackResult =
CallbackResult.CreateJavaScript(reApplyMapTipsPropsJavaScript);
// Add the CallbackResult to the map's collection so it will be processed on
// the client
Map1.CallbackResults.Add(reApplyMapTipsPropsCallbackResult);
}
}
Protected Sub Map1_ResourceRefreshed(ByVal sender As Object, _ ByVal args As ResourceRefreshedEventArgs) Handles Map1.ResourceRefreshed ' Check whether the resource being refreshed includes the MapTips GraphicsLayer If args.MapResource.Name = "ESRI ADF Layer Map Tips" Then ' Construct JavaScript to re-initialize client-side MapTips properties string reApplyMapTipsPropsJavaScript = "<initialization JavaScript>" ' Encapsulate the JavaScript in a CallbackResult CallbackResult reApplyMapTipsPropsCallbackResult = _ CallbackResult.CreateJavaScript(reApplyMapTipsPropsJavaScript) ' Add the CallbackResult to the map's collection so it will be processed on ' the client Map1.CallbackResults.Add(reApplyMapTipsPropsCallbackResult) End If End Sub