ArcIMS_AddDynamicData_CSharp\Default.aspx.cs
// Copyright 2010 ESRI // // All rights reserved under the copyright laws of the United States // and applicable international laws, treaties, and conventions. // // You may freely redistribute and use this sample code, with or // without modification, provided you include the original copyright // notice and use restrictions. // // See the use restrictions. // using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ESRI.ArcGIS.ADF.IMS.Data; using ESRI.ArcGIS.ADF.IMS.Display; using ESRI.ArcGIS.ADF.IMS; using ESRI.ArcGIS.ADF.IMS.Carto; using ESRI.ArcGIS.ADF.IMS.Carto.Layer; using ESRI.ArcGIS.ADF.IMS.Display.Renderer; using ESRI.ArcGIS.ADF.IMS.Display.Symbol; using System.Collections; public partial class _Default : System.Web.UI.Page { protected void Button1_Click(object sender, EventArgs e) { ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality mapFunc = (ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality)Map1.GetFunctionality(1); MapView mapView = mapFunc.MapView; ShapeWorkspace drainWkspc = new ShapeWorkspace("ShpWorkspace", @"C:\Program Files\ArcGIS\DeveloperKit10.0\samples\data\USAMajorHighways\"); FeatureDataset drainDataset = new FeatureDataset("usa_major_highways", drainWkspc); FeatureLayer drainLayer = new ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("usa_major_highways", drainDataset); drainLayer.Type = FeatureType.Line; SimpleLineSymbol drainSymbol = new SimpleLineSymbol(System.Drawing.Color.Brown, 3, LineType.Solid); SimpleRenderer drainRenderer = new SimpleRenderer(drainSymbol); drainLayer.Renderer = drainRenderer; drainLayer.Name = "usa_major_highways"; drainLayer.Visible = true; // ArcIMS map configuration file (axl) needs 'MAP dynamic="true"' to work mapView.Layers.Add(drainLayer); Map1.Refresh(); Toc1.Refresh(); // Expand all the Toc nodes upon postback ESRI.ArcGIS.ADF.Web.UI.WebControls.TreeViewPlusNodeCollection tvpnc = Toc1.Nodes; for (int i = 0; i < tvpnc.Count; i++) { ESRI.ArcGIS.ADF.Web.UI.WebControls.TreeViewPlusNode tvpn = tvpnc[i]; tvpn.Expanded = true; if (tvpn.Nodes.Count > 0) { foreach (ESRI.ArcGIS.ADF.Web.UI.WebControls.TreeViewPlusNode tvn in tvpn.Nodes) { tvn.Expanded = true; } } } } }