



















| Property Name | Type | Description |
|---|---|---|
| Initialized | bool | Indicates if the resource manager has been initialized during the current postback. |
| ResourceItems | GISResourceItemCollection <MapResourceItem> |
Returns a collection of MapResourceItems. Each MapResourceItem references a resource instance and display settings for the item. |
| Event Type | Description |
|---|---|
| ResourceInit | Occurs when initializing a single resource. More specifically, when the Initialize method is called with a parameter. |
| ResourcesDispose | Occurs when resources are disposed. More specifically, when the Dispose method is called, usually at the end of the ASP.NET page lifecycle. Occurs after the rendering phase in a full page postback and after GetCallbackResult in a callback. |
| ResourcesInit | Occurs when all resources are initialized. More specifically, when the Initialize method is called without any parameters. |
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// set initial definition properties here
}
}
if (!MapResourceManager1.Initialized)
MapResourceManager1.Initialize();
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase mrb = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase)
MapResourceManager1.GetResource(0);
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapdesc = mrb.MapDescription;
ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription layerdesc = mapdesc.LayerDescriptions[0];
layerdesc.DefinitionExpression = "OBJECTID IN (3,5)";
When working with non-pooled map services, a stateful change to the server
object is recommended. This will guarantee that a layer definition
will successfully limit both the display and query of layer
features. An ArcGIS Server local data source is
required to make a stateful change to a server object. Use
the following example as a guide. For a more detailed discussion on
making stateful changes to a map service, see the ArcGIS
Server section in the Access a data source
specific API discussion.if (!MapResourceManager1.Initialized)
MapResourceManager1.Initialize();
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal mrl = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)
MapResourceManager1.GetResource(0);
IMapServer ms = (IMapServer)mrl.ServerContextInfo.ServerContext.ServerObject;
IMapServerObjects2 mso = (IMapServerObjects2)ms;
IMap map = mso.get_Map(ms.DefaultMapName);
IFeatureLayer2 layer = (IFeatureLayer2)map.get_Layer(0);
IFeatureLayerDefinition2 definition = (IFeatureLayerDefinition2)layer;
definition.DefinitionExpression = "OBJECTID IN (3,5)";
mrl.RefreshServerObjects();
if (!MapResourceManager1.Initialized)
MapResourceManager1.Initialize();
ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapResource mr = (ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapResource)
MapResourceManager1.GetResource(0);
ESRI.ArcGIS.ADF.IMS.Carto.MapView mapview = mr.MapView;
ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer featurelayer = (ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer)mapview.Layers[0];
ESRI.ArcGIS.ADF.IMS.Carto.Layer.Filter filter = new ESRI.ArcGIS.ADF.IMS.Carto.Layer.Filter("#ID# < 10");
featurelayer.Filter = filter;