Server Marker Events

Sep 8, 2009 at 4:26 PM

 Hi,

Can someone help me understand how I program the code behind for the Drag Start and Drag End events of a marker? The below code is giving me an error.

 

 

 

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

protected

</font></font><font size="2" color="#0000ff">

 

</font>

 

void DragStart(object sender, GoogleMarkerEvents

e)

{

<font size="2">

Response.Write(

</font>

 

"Start!"

);

}

<font size="2">

 

</font>

 

protected void DragEnd(object sender, GoogleMarkerEvents

e)

{

<font size="2">

Response.Write(

</font>

 

"End!"

);

<font size="2">

 

</font>

 

<artem:GoogleMap ID="GoogleMap1" runat="server" Width="800px" Height="600px" Key=""  OnClientDragStart="DragStart" OnClientDragEnd="DragEnd">

</artem:GoogleMap>

 

 

Sep 9, 2009 at 8:31 AM

the  OnClientDragStart and OnClientDragEnd fire on the client side 

so you need some javascript code to handle them

here a simple javascript function 

 

<script>
function handleDragEnd()
     {
        var map = <%= GoogleMap1.ClientID %>;
         var mapcenter = map.getCenter();
         alert(mapcenter.lat()+' '+mapcenter.lng());
    }
</script>

you can see http://code.google.com/intl/fr-FR/apis/maps/documentation/reference.html#GLanguage for complete list of events and their parameters

 

hope it help