This project is read-only.

Maintaining state between post backs using __doPostBack();

Apr 28, 2009 at 10:18 AM



I have a question about the Google map control. I want to use the control inside a webpart that is inside an updatepanel and remain state between postbacks. This normaly works fine. But in my website I use ’__doPostBack('UpdatePanelMain', ''); to perform a postback from javascript. This results that the control doesn’t save the state becouse the functionsave: function() {……..’ in the javascript GoogleMap3.js doesn’t get fired.


If I test the control with a asp:button or a html submit button it works nicely between postbacks.

Is there an event I should fire before I fire the  ‘__doPostBack('UpdatePanelMain', '');’? Or does somewone have a beter solution? I would like to keep using the__doPostBack('UpdatePanelMain', '');becouse this is already nested on many places in the webapplication. Below I have a code example how I want to use the control.




code example:


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="GoogleMapsControlTest.WebForm1" %>


<%@ Register Assembly="Artem.GoogleMap" Namespace="Artem.Web.UI.Controls" TagPrefix="Artem" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">

<head runat="server">


    <script type="text/javascript">

        function test() {

            __doPostBack('UpdatePanelMain', '');






    <form id="form1" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server">



        <asp:UpdatePanel ID="UpdatePanelMain" runat="server">


                <asp:WebPartManager ID="WebPartManager1" runat="server">


                <asp:WebPartZone ID="WebPartZone1" runat="server">


                        <Artem:GoogleMap ID="GoogleMap1" runat="server" Latitude="51" Longitude="5" Width="400px" Height="400px" />





        <input id="Button1" type="button" value="refresh" onclick="javascript:test();" />







Apr 28, 2009 at 12:37 PM
Edited Apr 28, 2009 at 12:38 PM

You can probably manually invoke save of the GoogleMap control, but that's not a good solution.
I have found where the problem is and how can be fix and work for that kind of scenarios.
That will be fixed in the final release 4.0, which is coming soon.

Apr 28, 2009 at 12:39 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Apr 28, 2009 at 12:58 PM

Thanks for your quick replay!

I am looking forward to the final release then. But in the meanwhile, can you give me an example how I should invoke the save?
  So I have a temporarily workaround and already can start using your control?


Apr 28, 2009 at 8:11 PM
Using your code above I would suggest you try next for GoogleMap Control 3.5:

<script type="text/javascript">

        function test() {
            var map = <%= GoogleMap1.ClientID %>;

            __doPostBack('UpdatePanelMain', '');



For GoogleMap Control 4.0 beta you can do:

<script type="text/javascript">

        function test() {

            __doPostBack('UpdatePanelMain', '');




Apr 29, 2009 at 10:14 AM

Tanks for the example. This solved the problem for now!

May 4, 2009 at 8:55 AM
Hello Velio,

I've seen that ther is a new release of the googlemap control. I've tried if the problem was solved but unfortunately this is not the case.
Is there a chance this problem will be fixed in a update?