Customer Service | Training | Contact Us
You are here: Home > Downloads > ArcScripts > Search Results > Script Details Login | Feedback | Help

Move Layers (TOC refresh, Map refresh) AJAX



contact author | download help | add bookmark | view bookmarks
Author Zach Dwight
File Name MoveLayers.zip
Language VB.net
Last Modified May 9 2007
Status of work Public Domain
Software ArcGIS Server
File Size 12.74 kb
Downloads 1318

ArcScripts is intended for the free exchange of scripts and tools related to ESRI software products. Please alert the moderator if this script is a demo, trial-version, or an advertisement for a retail product.


Summary
Updated May 5th, 2007
****
Now you can move layers without doing the postback. I used two tool bar commands to move the layers and refresh both the map and the TOC so there is no annoying full page refresh. Using the AJAX already built into the toolbar commands, moving layers is now a lot prettier and quicker. Modify and enjoy.

UPDATED: Feb 5, 2007
****
Someone asked for the client side javascript, so I threw that in the text file as well, along with dimensioning all my variables for use with servercontext, etc.
****

UPDATED: FEB 2, 2007
****
Now layers are moved to match the changes you make in the TOC (using a callback) in both the map object and TOC! ENJOY!
****

VERY simple code snippet that allows you to create two buttons, up or down one index within the TOC control of a web application. I created two button events that trigger a javascript event that does a callback and uses the MoveLayer() method:

-Move Layer Up (with toc,map refresh)
-Move Layer Down (with toc,map refresh)

Modify it and spice it up with some graphics. In my case, I use the checked property to identify the node that should be moved. Pic included and error handling.

Thanks and enjoy!