Pitney Bowes MapXtreme User Manual

Page 93

Advertising
background image

Chapter 5: Web Applications, Controls, and Tools

ASP.NET AJAX and MapXtreme Web Applications

MapXtreme v7.1

93

Developer Guide

MapXtreme provides a sample application that demonstrates how to use Microsoft's ASP.NET AJAX
controls in a MapXtreme web mapping application. The sample is located in
..\MapInfo\MapXtreme\7.x.x\Samples\VisualStudio2005\Web\Features.

L

The AJAXDemo sample requires that the Microsoft ASP.NET AJAX Extensions 1.0 or later
be installed on your system.

The following section provides the steps to add AJAX controls to your MapXtreme application.

Before proceeding, as an exercise in understanding AJAX, it’s a good idea to create a web
application using the "ASP.NET AJAX-Enabled Web Site" template that is provided with the AJAX
extensions. Examine its Web.config file; the httpHandlers section and the httpModules section
contain settings that you may need to copy into your application.

You should also familiarize yourself with the AJAXDemo sample web application. The steps that
follow refer to JavaScript code and Web.config settings taken from this sample.

Adding ASP.NET AJAX Controls to a MapXtreme Web Application

To add ASP.NET AJAX controls to an existing MapXtreme web application:

1. Open your web form in Visual Studio’s Design mode.

2. From the "AJAX Extensions" section of the Visual Studio Toolbox, drag a ScriptManager control

onto the form. (It does not matter where you place the ScriptManager, as it will not be visible at
run-time.)

3. Drag an AJAX UpdatePanel control onto your form.

4. Move standard controls, such as Button controls, inside the UpdatePanel, to prevent the Button

from causing a full-page update.

L

Do not move MapXtreme controls, such as the MapControl or the LayerControl, inside
the UpdatePanel. For a detailed example, see the AJAXDemo sample application.

5. Open your application's Web.config file, and locate the httpHandlers section. Depending on the

contents of your web application, the httpHandlers section might contain just one or two entries -
one for MapController.ashx, and, if your application contains the LayerControl, one for
LayerController.ashx.
<httpHandlers>

<add verb="*" path="MapController.ashx" . . .
<add verb="*" path="LayerController.ashx" . . .

</httpHandlers>

6. Open the Web.config file from the AJAXDemo sample application, and locate its httpHandlers

section, which contains additional entries needed by ASP.NET AJAX:
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" . . .
<add verb="*" path="*_AppService.axd" . . .

Advertising