In my serverside event I have the following which is called:
Now.... the js variable is getting returned to the map as the map is centering wherever my marker is dragged to.
The problem is that none of the other serverside code is getting fired. The data retrieval logic is fine as I have tested it out via a button which calls a regular c# method.
It is only when I try and use the code from within the serverEvent function.
Please could you advise. (and please not just a quick link to one of your examples as they do not contain real life examples that I need) As a trade I can post my code when I have finished my project. It will be very useful to those starting from scratch like me.
Thanks.
switch (e.eventName)
{
case "markerDragged":
GMap1.resetMarkers();
GMap1.reset();
GMap1.enableServerEvents = true;
//add our draggable marker back into the mix
GMarkerOptions mOpts = new GMarkerOptions();
mOpts.draggable = true;
mOpts.bouncy = true;
mOpts.title = "Drag me to find your spot";
GMarker mkr = new GMarker(latlng, mOpts);
GMap1.Add(mkr);
GMap1.addListener(new GListener(mkr.ID, GListener.Event.dragend,
string.Format(@"
function(marker, point)
{{
var ev = new serverEvent('markerDragged',{0});
ev.addArg(this.getPoint());
ev.send();
}}", GMap1.GMap_Id)));
DataSet dsParkingSpaces = dataRetrieval.getParkingSpacesForGoogle(lng, lat, distanceSearch);
GMap1.DataLatField = "Latitude";
GMap1.DataLngField = "Longitude";
GMap1.DataBind();
js = string.Format("{0}.panTo(new GLatLng({1}, {2}, {3}))", e.who, lat, lng, 15);
break;
}
return js;
switch (e.eventName)
{
case "markerDragged":
GMap1.resetMarkers();
GMap1.reset();
GMap1.enableServerEvents = true;
//add our draggable marker back into the mix
GMarkerOptions mOpts = new GMarkerOptions();
mOpts.draggable = true;
mOpts.bouncy = true;
mOpts.title = "Drag me to find your spot";
GMarker mkr = new GMarker(latlng, mOpts);
GMap1.Add(mkr);
GMap1.addListener(new GListener(mkr.ID, GListener.Event.dragend,
string.Format(@"
function(marker, point)
{{
var ev = new serverEvent('markerDragged',{0});
ev.addArg(this.getPoint());
ev.send();
}}", GMap1.GMap_Id)));
DataSet dsParkingSpaces = dataRetrieval.getParkingSpacesForGoogle(lng, lat, distanceSearch);
GMap1.DataLatField = "Latitude";
GMap1.DataLngField = "Longitude";
GMap1.DataBind();
js = string.Format("{0}.panTo(new GLatLng({1}, {2}, {3}))", e.who, lat, lng, 15);
break;
}
return js;