ambrosia

Web application created with ArcGIS Server Manager and layers

Discussion created by ambrosia on Nov 20, 2011
Hello.

Using Server Manager I have created simple ArcGis Web Application. I have there few layers crated as in tutorial: http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#/Layer_properties_available_in_Manager/009300000086000000/

Is there any possibility to write Java Script code to change this layers visibility? I don't want to add any new layers in JavaSript but only menage this from my Web Application.

For now I see that:

1. I have created bunch of files and if I open project in VisualStudio there are Default.aspx and Default.aspx.cs files (and much more other)

2. I am adding in Default.aspx code for loading my JavaScript file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html id="Html1" runat="server" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">

<head id="Head1" runat="server">
........
........
</head>

<body>
..........
..........
    <script type="text/javascript" src="JavaScript/jsMyFile.js"></script>
    <script type="text/javascript">        
        var slider = null;
        window.onload = function () {
            slider = new jsMyFile(document.getElementById("slider"));
        }        
    </script>
..........
..........
</body>
</html>


3. In jsMyFile.js I have code:

function jsMyFile(o, ev) {    
    dojo.require("dijit.layout.BorderContainer");
    dojo.require("dijit.layout.ContentPane");    
    dojo.require("esri.map");  
    
    this.reset = function () {
     var map = $get("Map1");
            ............
            ............
    }
    ...........
    ...........
}


4. How can I change visibility of already created layers in my ArcGis Web Application from code in file jsMyFile.js ??? I was trying to debuge this code and in "map" object I don't see variable described as "layers", I don't see any method/functions to change layers visibility too.

What I want to do is to add slider to my ArcGis Web Application to change visibility of layers. Maybe I want to do this in wrong way? Any suggestions?

Thanks for any help.
Regards!

Outcomes