I have investigated this a bit further and found something interesting. More specifically I compared the source code of the ASPX view to the Razor view, and the following caught my eye:
ASPX view (working):
<table id=“map_MapContainer” cellpadding=“0” cellspacing=“0” border=“0” style=“width:1024px;height:768px;”><tr><td style=“text-align:left;background-image:url(bg_GeoResource.axd?ClientID=map_Map&PageName=FleetManager&Fresh=5608568&Format=image/png&Quality=100);margin:0px;height:100%;overflow:visible;”><div id=“map_Map” style=“height:768px;width:1024px;”>
Razor view (not working):
<table id=“1_MapContainer” cellpadding=“0” cellspacing=“0” border=“0” style=“width:1024px;height:768px;”><tr><td style=“text-align:left;background-image:url(bg_GeoResource.axd?ClientID=1_Map&PageName=FleetManager&Fresh=58405840&Format=image/png&Quality=100);margin:0px;height:100%;overflow:visible;”><div id=“1_Map” style=“height:768px;width:1024px;”>
The interesting part if the ID attribute of the table and div. For the Razor view, it is assigned ‘1_Map’ for some reason while for the ASPX view it is ‘map_Map’.
This ID is used for naming of the autogenerated javascript elsewhere on the page, such as this code block:
<script type=“text/javascript”>
//<![CDATA[
WebForm_InitCallback();var json1_Map={“resolutions”:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,8.58306884765625E-05,4.291534423828125E-05,2.1457672119140625E-05,1.0728836059570313E-05,5.3644180297851562E-06,2.6822090148925781E-06],“cid”:“1_Map”,“uid”:“1$Map”,“currentExtent”:{“left”:-131.22,“bottom”:16.91,“right”:-54.03,“top”:55.05},“cursor”:“default”,“baselayerid”:“StaticOverlay”,“staticOverlay”:{“w”:256,“h”:256,“transitionEffect”:“resize”,“singleTile”:“0”,“buffer”:0,“clientCache”:{“cacheId”:""},“imageFormat”:“image/png”,“jpegQuality”:100,“singleThread”:false,“visibility”:true,“otype”:“LAYER”,“extra”:“271158405840”,“projection”:“EPSG:4326”,“wrapDateLine”:“0”,“name”:“StaticOverlay”,“opacity”:1,“displayInLayerSwitcher”:true,“isBaseLayer”:true,“Id”:“StaticOverlay”,“tick”:false,“AutoRefreshMilliseconds”:0},“layers”:[{“parameters”:{“LAYERS”:“WorldMapKitLayer”,“STYLES”:“WorldMapKitDefaultStyle”,“CLIENTMODE”:“Web”,“SRS”:“EPSG:4326”},“transitionEffect”:“resize”,“singleTile”:“0”,“w”:256,“h”:256,“format”:“image/jpeg”,“otype”:“WMS”,“uris”:[“worldmapkit1.thinkgeo.com/CachedWmsServer/WmsServer.axd",“worldmapkit2.thinkgeo.com/CachedWmsServer/WmsServer.axd”,“worldmapkit3.thinkgeo.com/CachedWmsServer/WmsServer.axd”,“worldmapkit4.thinkgeo.com/CachedWmsServer/WmsServer.axd”],“wrapDateLine”:“0”,“tick”:false,“visibility”:true,“name”:“62c72223-7dc6-40f4-8264-06365d99a965”,“opacity”:1,“displayInLayerSwitcher”:true,“isBaseLayer”:true,“Id”:“62c72223-7dc6-40f4-8264-06365d99a965”,“AutoRefreshMilliseconds”:0}],“editOverlay”:{“mode”:“None”,“editSettings”:{“drag”:true,“reshape”:true,“resize”:false,“rotate”:true},“features”:[],“style”:{“fillColor”:"#0033FF",“fillOpacity”:0.31372549019607843,“strokeColor”:"#0033FF",“strokeOpacity”:0.62745098039215685,“strokeWidth”:1},“otype”:“VECTOR”,“visibility”:true,“name”:“EditOverlay”,“opacity”:1,“displayInLayerSwitcher”:false,“isBaseLayer”:false,“Id”:“EditOverlay”,“tick”:false,“AutoRefreshMilliseconds”:0},“highlightOverlay”:{“highlightStyle”:{“fillColor”:"#FF3300",“fillOpacity”:0.31372549019607843,“strokeColor”:"#FF3300",“strokeOpacity”:0.62745098039215685,“strokeWidth”:1},“click”:false,“features”:[],“style”:{“fillColor”:"#0033FF",“fillOpacity”:0.31372549019607843,“strokeColor”:"#0033FF",“strokeOpacity”:0.62745098039215685,“strokeWidth”:1},“otype”:“VECTOR”,“visibility”:true,“name”:“HighlightOverlay”,“opacity”:1,“displayInLayerSwitcher”:false,“isBaseLayer”:false,“Id”:“HighlightOverlay”,“tick”:false,“AutoRefreshMilliseconds”:0},“controls”:{“Measure”:{“measureType”:“PathMeasure”,“displaySystem”:“metric”,“geodesic”:false,“enabled”:false},“TouchNavigation”:{“enabled”:true},“AnimationPan”:{“delay”:300,“onClientClick”:"",“enabled”:false},“LayerSwitcher”:{“onLayerChanged”:"",“roundedCornerColor”:"#DDDDDD",“activeColor”:"#DDDDDD",“baseTitle”:"",“switchTitle”:"",“enabled”:false},“Navigation”:{“wheelDisabled”:false,“zoomBoxKeyMask”:“1”,“enabled”:true},“MousePosition”:{“showType”:“lonlat”,“enabled”:false},“OverviewMap”:{“maxRatio”:24,“minRatio”:8,“enabled”:false},“PanZoom”:{“zoomWorldIcon”:true,“enabled”:false},“PanZoomBar”:{“zoomWorldIcon”:true,“enabled”:true},“ScaleLine”:{“enabled”:false},“Logo”:{“enabled”:false},“KeyboardDefaults”:{“slideFactor”:75,“enabled”:false},“LoadingImage”:{“w”:0,“h”:0,“enabled”:false}},“units”:“DecimalDegree”,“onClientDrawEnd”:"",“onClientEditEnd”:"",“onClientClick”:"",“onClientExtentChanged”:"",“onClientBaseOverlayChanged”:"",“onClientDoubleClick”:"",“popups”:[],“pageName”:“FleetManager”,“click”:false,“dblClick”:false,“baseOverlayChanged”:false,“hasTrackShapeEnd”:false,“extentChanged”:false,“centerX”:-92.625,“centerY”:35.98,“zoom”:-1,“rootPath”:"/”};
var parser1_Map=new mapParser(json1_Map);
Sys.Application.add_load(keepsession);
Sys.Application.add_load(CreateAllMaps);
function CreateMap1_Map(sender,args){};
Sys.Application.add_load(CreateMap1_Map);
var 1_Map = new ThinkGeo(‘1_Map’);
function CallServerMethod1_Map(args, context) {
WebForm_DoCallback(‘1$Map’,args,AutoRefreshCompleted,context,null,false);
}
//]]>
</script>
As far as I know, javascript variables cannot start with a number. Can this be the reason for the problem? I can also add that IE reports “Identifier expected” javascript error on the following line:
var 1_Map = new ThinkGeo(‘1_Map’);
The question then becomes, why is MapSuite doing this and how to avoid it?
I hope this can help.