[mapguide-users] Legend Doesn't Refresh

Greg gbneff at cid.utah.gov
Tue Mar 1 19:07:44 EST 2011

I am using the basic layout viewer.

When I add the layer as shown below the layer is  added.  I am trying to
refresh the legend so the new layer appears but it doesn't happen until I
manually refresh the legend by right clicking and hitting refresh.  I am
probably trying to refresh things wrong but can't find my error.  I am not
adding the layer to a group.  Don't know if it makes a difference.

        //add layer to map if it doesn't already exist (copy from repository
to session)
        String strTruckRouteLayerResID =
        String strLayerName = "truck_route";
        String strLegendLabel = "Unit" + strUnitNo + "   " + strDate;
        MgResourceIdentifier layerRes = new
        MgLayer layerTruck = new MgLayer(layerRes, resService);

        //add layer to map if it doesn't already exist
        MgLayerCollection layers = map.GetLayers();
        if (!layers.Contains(strLayerName))
            layers.Insert(0, layerTruck);

<script type="text/javascript">

    function mapRefresh()
        var map = document.GetMapFrame();
        var legend = map.GetLegendCtrl();


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Find Truck Route Result</title>
    <link rel="stylesheet" type="text/css" href="cid_style.css" />
<body onload="mapRefresh">


View this message in context: http://osgeo-org.1803224.n2.nabble.com/Legend-Doesn-t-Refresh-tp6079198p6079198.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

More information about the mapguide-users mailing list