setting Map location from serverside code

Nov 27, 2009 at 6:57 PM

Hi to everybody,

Last Time I was trying to show a marker location using a selected row of a Grid View

The goal is select a marker from a Grid and the selectedIndexChanged event handler should

set  the current Google map location to this Marker, but when I try this I get a javascript exception

the Google map configuration is the following:


                    <gm:GoogleMap ID="GoogleMap1" runat="server" 











And my Server side code is the following


        protected void gv_Comercios_SelectedIndexChanged(object sender, EventArgs e)
            GoogleMap1.Zoom = 16;
            GoogleMap1.Latitude = double.Parse(gv_Comercios.SelectedRow.Cells[4].Text.ToString());
            GoogleMap1.Longitude = double.Parse(gv_Comercios.SelectedRow.Cells[3].Text.ToString());            





        protected void gv_Locations_SelectedIndexChanged(object sender, EventArgs e)


            GoogleMap1.Zoom = 16;

            GoogleMap1.Latitude = double.Parse(gv_Locations.SelectedRow.Cells[4].Text.ToString()); //This columns has the Marker Latitude

            GoogleMap1.Longitude = double.Parse(gv_Locations.SelectedRow.Cells[3].Text.ToString()); //This columns has the Marker Longitude            


so the map should make a 16 points zoom and set the current location to this marker

Another detail is that the grid is inside an update panel and the map is outside it due to the problem of a GoogleMap inside a UpdatePanel.

The question is, this javascript exception could be because an updatePanel configuration? 

Thanks in advance