Triggered when the map is finished loading

Namespace: Reimers.Google.Map
Assembly: Reimers.Google.Map (in Reimers.Google.Map.dll) Version: 5.3.95.699 (5.3.95.699)

Syntax

C#
public event EventHandler<BoundsEventArgs> MapLoaded

Remarks

Some map tiles map still be loading when the event triggers.

The event is triggered as a result of a asynchronous callback to the server. While this allows for event handling using serverside code, all changes to the page (either the map or other controls on the page) must be done using JavaScript commands passed to the MapCommand of the event arguments parameter.

Examples

The following code is an example of how the overlays collection can be filled with markers within the bounds of the map when it loads. The code loops through a DataTable and checks whether the coordinates held in the table are within the bounds of the map. If so they are added to the map's overlay collection and a command to render them is generated.

CopyC#
void Map_MapLoaded(object sender, BoundsEventArgs e)
{
    foreach (DataRow dr in dt.Rows)
    {
        double lat = (double)dr["Lat"];
        double lng = (double)dr["Lng"];
        if (lat < Bounds.MaxLatitude && lat > Bounds.MinLatitude && lng < Bounds.MaxLongitude && lng > Bounds.MinLongitude)
        {
            e.MapCommand = e.Map.AddOverlay(new Marker((string)dr["ID"], lat, lng), true);
        }
    }
}

See Also