|     Blog    |     Wiki    |     Support

Markers Is Visible Attribute

I am having issues with the Markers IsVisible attribute. I have about 12 markers in a SimpleMarkerOverlay. The visibility of the layer is set to true. I have all of my Markers Visibility set to false. I would like to be able to turn on/off these markers as needed.

When I go to run the page, the Markers are all Visible, even though the IsVisible attribute is false. To try and fix this, I turned the SimpleMarkerOverlay IsVisible attribute to false. When I did this, even though I later set the value of this overlay as well as some of the markers to true, none of the Markers were showing up. I am doing all of this OnExtentChange and then using map.ajaxCallAction.


Hi Josh,

It turns out to be a bug which has been fixed in version 9.0.360.0 and, please get it when it’s available and have a try again.

After callback from controller, we need to redrawLayer to refresh the marker overlay, the code maybe like:

function mapClick(e) {
    Map1.ajaxCallAction('@ViewContext.RouteData.Values["Controller"].ToString()', 'ClickEvent', { 'x': e.worldXY.lon, 'y': }, function (result) {


Hi Peter,

I will gladly check to make sure that everything works as soon as I see that version in the daily builds. Another issue I am encountering is that map.currentextent does not up to date when I use the ajaxCallAction. Instead, all it shows is the original extent. Currently I am just passing the extent as a string from javascript and parsing it.


Hi Josh,

I think if you do some operation via ajax, then you need to handle the result in client side, or else the map won’t refresh automatic.

So if you modified map extent, please update that in client side also.

If I misunderstand your scenario, please let me know and provide more detail information.




Just to let you know that fixed my issue thank-you!


When I debug the map on an Ajax call. The map that exists on server side, has not been updated at all. It maintains the original extent and center. I noticed this when I was making an Ajax call onExtentChanged, and noticed that the map extent was never changing.


Hi Josh,

The extent is not automatically updated, we can add some logic to update it manually.

The following are the code snippets show how to update the server-side extent and client-side extent


@{Html.ThinkGeo().Map("Map1", new System.Web.UI.WebControls.Unit("100%"), 510)
        .CurrentExtent(-125, 72, 50, -46)
        // Adds ExtentedChanged event.	

function extentChanged(e) {
    var extent = Map1.getExtent();
    var extentStr = extent.toString();
    var extentStrextentStrArray = extentStr.split(",");
    if (Map1.ajaxCallAction) {
	// sent client extent to server-side
        Map1.ajaxCallAction('@ViewContext.RouteData.Values["Controller"].ToString()', 'ExtentChanged', extentStrextentStrArray, callback);
function callback(result) {
    // updae client-side extent.
    var parameters = result.get_responseData().split("|");
    var extent = parameters[0].split(",");
    var bbox = new OpenLayers.Bounds(extent[0], extent[1], extent[2], extent[3]);

=== Controller.cs===

public string ExtentChanged(Map map, GeoCollection<object> args)
    var target = args[0].ToString();
    double minX = double.Parse(args[0].ToString());
    double maxY = double.Parse(args[3].ToString());
    double maxX = double.Parse(args[2].ToString());
    double minY = double.Parse(args[1].ToString());
    map.CurrentExtent = new RectangleShape(minX, maxY, maxX, minY);

    // sent extent to client-side
    var extent = map.CurrentExtent;
    string extentString = string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", extent.LowerLeftPoint.X, extent.LowerLeftPoint.Y, extent.UpperRightPoint.X, extent.UpperRightPoint.Y);

    return extentString;

Also you can refer to,AllSamples,FeaturedMvc

Hope this can help,


Another issue I am having with the IsVisible Attribute. I am using a Simple Marker Overlay and I am starting with the value turned to false. I then make a server side call to turn the layer on when a user zooms in. However, the Overlay does not become visible. I made sure I was redrawing the correct layer. I have also tried setting the visibility attribute in JavaScript and that is not working.


Hi Joshua,

Where you tried to switch the layer status? I think for MVC, if you set IsVisible equal false, that means this layer hadn’t been loaded to client side, so it’s not exist for client side, that’s why you cannot show it via JavaScript or any client side event.

So here we should have two ways for solve it:

  1. Call a page refresh and show this layer on server side, then this layer will be loaded in client side
  2. Make the status as visible, then in our OnMapCreated function to set it as hide by JavaScript, after that you can set it’s status. I think you can get some useful code from this topic: Issues With Adding layers

Wish that’s helpful.



Hi Don,

Option two did the trick for me. Thank-you for your help.


Hi Josh,

I am glad to hear that’s helpful.