作为Google的电子地图,在JavaScript中调用很简单,当然,你可以在Asp.net中注册这些代码,在页面开始加载的时候自动加载Google ditu.
protected void Page_Load(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript",
"var mapTypes = [];"+
"mapTypes.push(G_NORMAL_MAP);"+
" mapTypes.push(G_PHYSICAL_MAP);"+
"var mapTypesControl = new GHierarchicalMapTypeControl();"+
" mapTypesControl.clearRelationships();"+
"var map = new GMap2(document.getElementById('map'),{mapTypes:mapTypes});"+
" map.setCenter(new GLatLng(39.54, 116.23), 6);"+
" map.addControl(new GLargeMapControl());"+
" map.addControl(new GScaleControl());//地图比例尺"+
" var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(158,7)); "+
" map.addControl(mapTypesControl,topRight);"
,true );