This project is read-only.

Server side event on markers

Feb 28, 2008 at 9:48 AM
Hi velio, First of all thanks for this wonderful control. it did solve lots of my problems.

I have been adding markers to control and i would like to find out the markers position on the server side (in particular when we drag a marker to a new location).

Is this possible? How do i get its position (Lat and Lng)?

protected void HandleDragEnd(object sender, EventArgs e)
GoogleMarker marker = sender as GoogleMarker;
if (marker != null)
// marker is moved to new location and want to find out its new lat and lng...
// i also want to calculate its distance from each of other markers on the control

Feb 28, 2008 at 12:58 PM
So far the only thing you can do is to attch client-side code to OnClientDragEnd of the marker and then add the additinal functionality to solve your problem.
However, the questions is good and honestly when I implemented events I tought later I have to extend server-side events and sending to them goole map arguments, as well.
Further more, grag is a special event for markers and I will for sure add functionality to track the event and persist the new position of marker after drag in its Latitude/Longitude properties.
So, those features will and must be implemented for GoogleMap control. Just I have the usual problem - so much work, so less time :(.

Feb 28, 2008 at 4:32 PM
Hi velio,

Thanks for your reply..
How to capture marker position on client side with drangEnd event. I tried various methods but didnot work. hope u could guide us to right solution.

Feb 29, 2008 at 4:44 PM
Edited Feb 29, 2008 at 4:47 PM
By default as you can see from Google Maps API dragend event of GMarker has no arguments.
That's why I have played a lot with client side code invokation - delegates.
I just have no free time to produce some samles about that to show its real power.
So, in short you can send the current instanse of the makers to the event handler and then get marker's position.
Here is a quick and short example:
<script type="text/javascript">
    function handleGragEnd(m) {
        var point = m.getLatLng();
<artem:GoogleMap ID="GoogleMap1" runat="server" Height="512px" Width="512px" Zoom="4" Address="sofia bulgaria">
        <artem:GoogleMarker Address="sofia bulgaria" OnClientDragEnd="handleGragEnd(this)" Draggable="true" />

Oct 6, 2010 at 10:27 AM


are there some news about this functionality? I would really like to know if there is a way to handle everything from the server-side since I would like to create a control without markup, and so I will not have the possibility of adding client side scripts...