Hi,
I've been struggling now for best part of two days with this and am comply stuck. If anyone can help me then I will post my finished code for the application for the benefit of others.
Problem scenario:
1. Draggable marker - when dragged it will centre the map
2. Server side event gets a list of geo locations within a given radius
3. Plot markers on a map based on the returned database values
4. Display a databound control (grid view, list view, datalist, whatever) with database field values
So far I have been able to achieve parts 1, 2 and 3.
I have got as far as databinding the grid view (I have tested this is happening in the code behind but I am unable to get it to render on the page).
I have also tried using a side bar but am also unable to get this to render.
My .cs code is below, any help would be immensely appreciated.
protected void MarkerDragEnd(object sender, MarkerDraggedEventArgs e)
{
StringBuilder addAllOverlays = new StringBuilder();
float distanceSearch = (float)Convert.ToDouble(lstSearchRadius.SelectedValue.ToString());
DataSet dsParkingSpaces = dataRetrieval.getParkingSpacesForGoogle(e.To.Longitude, e.To.Latitude, distanceSearch);
GoogleMarkerOptions mOpts = new GoogleMarkerOptions();
mOpts.Draggable = false;
for (int i = 0; i <= dsParkingSpaces.Tables[0].Rows.Count - 1; i++)
{
mOpts.Title = dsParkingSpaces.Tables[0].Rows[i]["PostCode"].ToString();
GoogleLatLng latlngMarker = new GoogleLatLng(Convert.ToDouble(dsParkingSpaces.Tables[0].Rows[i]["Latitude"]), Convert.ToDouble(dsParkingSpaces.Tables[0].Rows[i]["Longitude"]));
GoogleMarker mkr = new GoogleMarker(dsParkingSpaces.Tables[0].Rows[i]["ID"].ToString(), latlngMarker, mOpts);
addAllOverlays.Append(e.Map.AddOverlay(mkr));
}
//PROBLEM CODE - I am binding the datagrid but it is not showing up on the page
grdTest.DataSource = dsParkingSpaces;
grdTest.DataBind();
//re-create the draggable marker
GoogleMarker dMarker = new GoogleMarker("draggableMarker", new GoogleLatLng(e.To.Latitude, e.To.Longitude));
dMarker.Options.Draggable = true;
dMarker.Options.Title = "This control is cool!!!";
dMarker.Options.UpdateAfterDrag = true;
addAllOverlays.Append(e.Map.AddOverlay(dMarker));
e.MapCommand = e.Map.ClearOverlays() + addAllOverlays.ToString() + GMap.PanTo(new GoogleLatLng(e.To.Latitude, e.To.Longitude));
}