Turning on and off graphic layers

Discussion created by buddha198 on Oct 13, 2011
Latest reply on Oct 14, 2011 by njarecha-esristaff
I have been experience some weird issues about when I add graphic layers to the map. I have a page where you can turn layers (including graphic layers) on and off. What I do is when view is loaded, I do some queries and populate them with data. I then only add them to mapview after someone checked them to be visible. And if unchecked, I removed from mapview. But does not seem to behave like expected. Nothing every changes on the map. I never see the graphics.
Right now I have switched to instead loading them all when view has been loaded. Then if check to see I run query to populate graphic layer. If uncheck- remove graphics. I think this is Ok workflow but was wondering if I missed something with other approach. THe only difference I can see is that in option that doesn't work- the datachanged is called on graphicslayer before being added to mapview. But I don't see why that would be the issue.