Select to view content in your preferred language

Can I use radio button to change layers in the same map service?

738
3
03-31-2011 09:33 AM
DanDong
Deactivated User
Hi all,

I had different layers published using one map service and I want to use radio button to switch layers. I noticed from ESRI's sample (http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SwitchMap) that radio button can be used to switch layers between different map services. I am wondering if I can switch layers in one single map service. I tried...but didn't get the good results. Do anyone use such thing before? Any suggestion? Thank you:)
0 Kudos
3 Replies
BrentHoskisson
Frequent Contributor
I assume by "change layers" you mean toggling between invisible and visible layers.  First you have to have the layer on your map as a Dynamic layer.  Second every layer you want to change between must be in the service.

Then just create your check event for the radio buttons.  In that event you can connect to your service layer which will have a VisibleLayers property which is an integer list of all the visible layers.  Set only the ones you want.

Good Luck
0 Kudos
DanDong
Deactivated User
I assume by "change layers" you mean toggling between invisible and visible layers.  First you have to have the layer on your map as a Dynamic layer.  Second every layer you want to change between must be in the service.

Then just create your check event for the radio buttons.  In that event you can connect to your service layer which will have a VisibleLayers property which is an integer list of all the visible layers.  Set only the ones you want.

Good Luck


Hi Brent,

Thank you very much! That works very well! I use the setvisibility method to set visibility for a particular layer. 🙂
0 Kudos
TanyaOwens
Frequent Contributor
Hello,

I am trying to do something similar but I am completely stuck. Maybe if you would be willing to take a look at my forum post to see if you can point me in the right direction I would greatly appreciate it.

http://forums.arcgis.com/threads/66829-Radio-buttons-to-toggle-layers-from-a-Dynamic-map-service-lay...

Thanks!!
0 Kudos