Hi, I'm new to this world and I really need some help. When we load
the page below, it is supposed to create markers and bring the
address, using reversegeocode, in the info box. Apparently for some
reason, the cookie is not being created. Would you be able to help me
out? I just can't see the reason.
Any help is greatly appreciated.

Page: http://200.170.102.176/ezgps/monitor/monitor.aspx

Code:

System.Text.StringBuilder sb = new System.Text.StringBuilder();
if (!IsPostBack)
{
sb.Append("var rg; var rgAddress; var currentVehicleID;");
sb.Append("rg = new GReverseGeocoder(" + GMapCurrent.GMap_Id + ");");
sb.Append("GEvent.addListener(rg, 'load', function (placemark)
{ createCookie('rg_' + currentVehicleID, placemark.address,
2); } );"); //believe something wrong here***********
sb.Append("function SetMarkerListener(marker, content, vehicleID)
{ GEvent.addListener(marker,'click',function()
{  marker.openInfoWindowHtml(content.replace('<ADDRESS>','<br>Address:<b>'
+ readCookie('rg_' + vehicleID) + '</b>')); }); }");
sb.Append("function setReverseGeocode(lat, lng, vehicleID)
{ currentVehicleID = vehicleID; rg.reverseGeocode(new GLatLng(lat,
lng)); }");
sb.Append("createContextMenu();");
}

GMapCurrent.addCustomInsideJavascript(sb.ToString());

// Loop through all DataRows, create markers and windows
foreach (DataRow dr in arrCurrentPageRow)
{
try
{
sb = new System.Text.StringBuilder();

latLng = new GLatLng(double.Parse(dr["Latitude"].ToString()),
double.Parse(dr["Longitude"].ToString()));
arrLatLng.Add(latLng); // Arraylist used to calculate Zoom and Map
center
mOpts = new GMarkerOptions();
mOpts.clickable = true;
mOpts.icon = ProttEngine.GetIcon(dr["VehicleStatusID"].ToString(),
dr["Direction"].ToString());
marker = new GMarker(latLng, mOpts);
marker.ID = "marker" + iHashIndex.ToString();

//Section below required for Reverse Geocode functionality
string sWindowInfoContent = "<table cellspacing=0
cellpadding=0><tr><td align=left><font size=1>ID do Veículo: <b>" +
dr["VehID"].ToString() + "</b><br>Motorista: <b>" +
dr["Driver"].ToString() + "</b><br>Velocidade: <b>" +
                                                                                
dr["Actual Speed"].ToString() + " km/h</b><br>Status do
Motor: <b>" + dr["Engine"].ToString() + "</b><br>Status do Veículo:
<b>" + dr["Veh Status"].ToString() + "</b><ADDRESS><br>Data Última
Atualização: <b>" + dr["DateUpdated"].ToString() + "</b></font></td></
tr></table>";

// Add current marker in a hash

// Triggers reverse geocode task and saves result in a cookie
sb.Append("var marker" + iHashIndex.ToString() + ";"); //force a
declare so it won't crash on postback
sb.Append("setReverseGeocode(" + dr["Latitude"].ToString() + ", " +
dr["Longitude"].ToString() + ", '" + dr["VehID"].ToString() + "');");
//Only sets listener if marker is on the page - (issue that can be
called multiple times when navigating back and forth)
sb.Append("if (marker" + iHashIndex.ToString() + ") {");
sb.Append("SetMarkerListener(" + marker.ID + ",'" + sWindowInfoContent
+ "','" + dr["VehID"].ToString() + "');");
sb.Append("}");

GMapCurrent.addCustomInsideJavascript(sb.ToString());

GMapCurrent.addGMarker(marker);
iHashIndex++;

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to