How to set visibility of a layer by code

Discussion created by on Jun 18, 2014
I've been tasked to create a method to store current checkbox values. I'm using loaclStorage and I can retrieve:

the LayerID, the, and if the layer/sublayer was checked visible. As I'm reading each item from localStorage, I'd like to set the visibility for the layer.

for example I've stored the layer "Basemap", and the SubLayer is Roads (Index# 2) and the visible value was False.

Is there a code like:


That would work?