Select to view content in your preferred language

Hide visibility of one table in ArcGISDynamicMapServiceLayer

1873
1
08-10-2014 11:49 PM
JulieBiju
Deactivated User

Dear All,

I need urgent help

<esri:ArcGISDynamicMapServiceLayer ID="StreetMapLayer" Url="http://www.site.com/arcgis/rest/services/Ss/map1/MapServer"/>

In my web application map is showing properly . In StreetMapLayer I have 10 tables named (nametab,countrytab,sertab, etc....). Now I can see all these 10 layers when I run the application.

Now my requirement is , we dont want to give permission to one user to see 2 layeres from these 10 layers.How can I hide countrytab,sertab from code behind?

Pls help me

0 Kudos
1 Reply
AsserSwelam1
Deactivated User

Hi Julie,

Sure you can.

using the VisibleLayers property for the DynamicMapServiceLayer.

lets say your user names notAllowedUser and your countrytab is the second layer on the map with index 1 and sertab is tenth layer on the map with index 9.

you will create a int array contain all layer indexes except this two like below and set it to the DynamicLayer.

if( notAllowedUser is the logged user)

{

     int[] myVisibleLayers = {0, 2, 3, 4, 5, 6, 7, 8};

     myArcGISDynamicMapServiceLayer.VisibleLayers = myVisibleLayers;

}

else

{

     int[] myVisibleLayers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

     myArcGISDynamicMapServiceLayer.VisibleLayers = myVisibleLayers;

}

That will help too too

ArcGIS API for Silverlight API Reference| ArcGIS for Developers

Hope that helps.

Thanks,

Asser