Skip to main content

Reference Library

Go Search
Reference Library
  
Reference Library > Wiki Pages > MDNAjaxPage  

MDNAjaxPage

Overview
 
MDNAjaxPage inherits System.Web.UI.Page and adds Ajax support for MapDotNet Server Web Server Controls used within a page. Pages using MDNS can inherit this page for rapid development as a fair amount of out-of-band communication links between controls and the page are set up for you.  The "default.aspx" page in the web site template "MDNSTemplateCSharp" is an excellent example of a page derived from MDNAjaxPage.
 
The MDNAjaxPage provides a foundation for client and server interaction. The following diagram shows a high-level flow of events:
 
MDNAjaxPage Flow
 
Configuration
In its most basic configuration very little setup is needed. The project template in fact has additional support for a resizable mapping page. A less complex page where the map is not resizable could do all of its setup in Page_Load. This code block is all that is needed for a completely functional MapDotNet Server page in ASP.NET using the MDNAjaxPage:
 
protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        // initial setup code
        if (!IsPostBack)
        {
            // we start in zoom-in mode
            // "Zoom In" is actually the default startup mode for the MapToolset anyway
            MapToolset1.TBMode = Mode = "Zoom In";
           
            // draw mode used for "Zoom In"
            MapNavigator1.DrawMode = ISC.MapDotNetServer.Controls.MapNavigator.DrawModes.Envelope;
 
            // places an event trap div over the app when calling back out-of-band
            // this is a good idea as parallel requests can cause the MapTOC client representation
            // to be out of sync with the server
            BlockUsesEventTrap = true;
 
            // initialize map to the specified MapID in the MapControlBridge
            MapControlBridge1.MapInitialize();
 
            // draw the map
            MapControlBridge1.Draw();
        }
    }
    catch (Exception ex)
    {
        MapControlBridge1.HandleException(ex);
    }
 
Overrides
Several methods on the MDNAjaxPage are protected virtual methods. These may be overriden to provide custom functionality. The most notable are:

BindMapControlBridge - called on inital page-load-complete. You can extend this to perform your own custom event wiring

All "WM" Methods - these are all ScriptMethods with full access to the Page instance called from the client through Ajax. You can override these to change the behavior of client event handling. Most of these methods return a MapClientStateUpdate instance.

LoadMapClientStateUpdate - this method updates the object passed back to the client (in the Ajax callback) to update the entire state of affairs (or portions thereof) on the client regarding map state, image, extents, shapes, etc.

ProcessMap[Units/Pixels] - these methods process data submitted by a MapNavigator control on the page.

MapNavEnvelopeChangeEvent - this is a common point to override and define your own custom behaviors when the map extents (map envelope) changes.
 
MCBPre/PostDraw - these are convenience methods to override to insert custom behaviors into the map drawing process.

Last modified at 11/11/2008 6:11 PM  by WEB\mark