Hi,
I have a problem with setting my current extent using the bounding box. I have a page that displays the map, with a list of layers that is at the moment checkboxes and hyperlinks. The user can click on a hyperlink that takes him to a different page where he can set the properties of the selected layer. The second page receives a session variable from the first page to set the active layer. The page contains a map with only the active layer and a set of dropdownlists - one contains all layers (defaults to active layer), another one the fill color and another one the line color.
As soon as the user come in from the first page my extent is not calculated on the specific layer. This is an example:
I have a list of checkboxes that is layers in my first page: Countries, Province, Cities .... These layers is displayed in the map with the ability to switch layers on and off. The user click on Province and LayerProperties page opens that contains a map that displays only the Province layer and a dropdownlist that contains Countries, Province and Cities with the Province layer selected. The extent is not calculated correctly. I change the layer to Cities and the Cities layer is created with the correct extent. I change back to Province and now the extent is calculated.
This applies to all the layers, seems that the onload of the page is not setting the current extent correctly and I am not sure why.
This is my code:
ShapeFileFeatureLayer layer = new ShapeFileFeatureLayer(MapPath("~/" + strServerLocation.ToString()));Map1.StaticOverlay.Layers.Add("Province", layer);
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel =
layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = lineColor;
layer.Open();
Map1.CurrentExtent = layer.GetBoundingBox();
layer.Close();
Map1.StaticOverlay.Redraw();
ApplyUntilZoomLevel.Level20; layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Country1(ddlDefaultLabel.SelectedValue.ToString());
I tried it with FeatureSource but still the same problem. I also tried to first set the style before adding the layer but still same problem. Can someone please help me?
Thanks,
Sonja