Adding an infotool to a web application, Asp.net ajax and mapxtreme web applications, Asp.net ajax – Pitney Bowes MapXtreme User Manual

Page 92: And mapxtreme web applications, Adding an, Infotool to a web application

Advertising
background image

Chapter 5: Web Applications, Controls, and Tools

Adding an InfoTool to a Web Application

MapXtreme v7.1

92

Developer Guide

Adding an InfoTool to a Web Application

MapXtreme provides a sample application for an InfoTool that can be adapted and used in a web
application. Use this tool to capture information at the point a user clicks on the map and get
information returned from the web application.

Follow these steps to modify the InfoTool sample.

1. Locate the InfoToolCS or InfoToolVB Web Application in the samples folder (default location

C:\Program
Files\MapInfo\MapXtreme\7.x.x\Samples\VisualStudio20xx\Web\Features\InfoTool\InfoToolVB.

2. Copy the following files to your project folder and add them to your project:

CustomCommand.js from the root of the InfoTool folder

CustomizedCommands.cs or CustomizedCommands.vb from the \App_Code folder

stylesheet.css from the root of the InfoTool folder.

3. Add a PointSelect tool to your Web Form and add the code below in the form’s Page_Load

method:
MapInfo.WebControls.MapControlModel controlModel =
MapControlModel.SetDefaultModelInSession();
controlModel.Commands.Add(new CustomWebTools.Info());

4. Match the properties of the PointSelect tool to those of the InfoTool from the sample application.

Set these in the tool’s Properties window.
These properties include: ClientCommand, ClientInteraction, Command, CursorImageURL,
InactiveImageURL. and MapControlID.

5. Switch the form to the HTML view and add the following line after the <form> tag.

<script language="javascript" src="CustomCommand.js"
type="text/javascript"></script>

6. Add a <div> like the one in the sample application to hold the information retrieved by the tool.

<div id="Info" class="infoDiv">
Div&nbsp;element to display selected feature information in
html table.</div>

7. Build the Web Application.

ASP.NET AJAX and MapXtreme Web Applications

MapXtreme’s web controls and tools include JavaScript which provides an efficient
request/response cycle for web applications. Each time a map tool is used, JavaScript interactions
and commands carry out the operation without requiring a full-page postback to the client. Typically,
only the map image is refreshed.

Microsoft’s ASP.NET AJAX technology takes this behavior further, by integrating scripting libraries
with the ASP.NET Framework. The principal controls are the UpdatePanel, a container for server
controls that are frequently refreshed, and the ScriptManager, which manages the scripting activities
for the web page.

Advertising