How to disable or enable layer in ajaxmap ?

Aug 12, 2013 at 12:06 PM
Edited Aug 12, 2013 at 12:09 PM
Hi every one
I am trying to disable or enable layer from ajaxmap,I am trying to do it this way

ajaxMap.Map = MapHelper.InitializeMap(new System.Drawing.Size(10, 10));
    if (!Page.IsPostBack && !Page.IsCallback)
    {
        ajaxMap.Map.Layers[0].Enabled = false;
        ajaxMap.Map.ZoomToExtents();

    }
    ajaxMap.ResponseFormat = "maphandler.ashx?MAP=SimpleWorld&Width=[WIDTH]&Height=[HEIGHT]&Zoom=[ZOOM]&X=[X]&Y=[Y]";
I am trying to make it in the default.aspx.cs because I am thinking about making in the future a button that disable or enable the layer.
The layer disabled and enabled perfectly fine in the maphelper.cs but its not working in the deault.aspx.cs
Thanks every one for taking the time to read my problem and hope you can help me.