Zum Hauptinhalt gehen

Apply Layer Definition Query at startup

Kommentare

2 Kommentare

  • Permanently deleted user

    Hi all,

    I have tried to make a custom startup action to apply a layer definition query to the parcels layer at start up. The followingcode which gives error at the bold line of the code below.

     

    namespace CustomStartupActions

     

    {

     

        public class UserVerifyStartupAction : StartupAction

     

        {

     

            public override void ExecuteAfterConstruct()

     

            {

     

    if (!Page.IsPostBack && !Page.IsCallback)

     

    {

     

    ESRI.ArcGIS.ADF.Web.UI.WebControls.Map adfMap = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)Page.FindControl("Map1");

     

                   

     

                       ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality agsMapFunctionality = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adfMap.GetFunctionality(0);

     

                    if (agsMapFunctionality != null)

     

                    {

     

                        LayerDescription ld;

     

                        ld = agsMapFunctionality.MapDescription.LayerDescriptions[3];

     

                        ld.DefinitionExpression = "parcel_id=121";

     

                        adfMap.Refresh();

     

         }

     

    }

     

    }

     

    }

    The Error Message is “Index was out of range. Must be non negative or less than the size of the collection”. Could someone out there help??

     

    Regards,

    Yakeen

    0
  • Permanently deleted user
    I get this error when the query doesn't exist - e.g is parcel ID  = 121 a valid number? is it the right format? does this work instead? "parcel_id='121'"
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.