Update Map without refreshing?

Mar 27, 2008 at 10:47 PM

anyway to update the map, without a postback or callback?
Mar 28, 2008 at 7:58 AM
Edited Mar 28, 2008 at 7:58 AM

It could be possible.
As I have promoted in last releases I have extended the JS model and it can be used on the client-side.
Further more, if you do some changes in the client-side code, let's say for example you add a marker through the JS code, then if you later postback to server, that marker will be persisted to the server-side.
In some cases that could be very helpful and be used very advanced.
That's why I did extend the JS model.
It's a shame I have no time recently for making some really good samples about that (too busy :( - a lot of projects working on).

However, please, give me some short description of what you need to do and how you want to be working and I will try to produce a sample page durring this week-end.

Mar 28, 2008 at 2:35 PM
Edited Mar 28, 2008 at 2:37 PM
wow velio;

that would be great. i have played around with the google JS api, or was considering writing WebMethods that your API.

my need would be: i have 5 "friends" whose location is stored in the database, and updated automatically. i want to display their changes, on my map, automatically (every 30 seconds), without a panel refresh.

2) also, i am wondering how i can get the current zoom level from the map? so when i refresh it, it takes the current zoom.

right now i am using a timer and a panel.

Mar 31, 2008 at 6:54 AM
I have not forgot about the sample, just a busy wee-end :).
I'll do it tonight.

Mar 31, 2008 at 6:24 PM
Mar 31, 2008 at 9:20 PM

So, first because of the nature of UpdatePanel if you put a GoogleMap control inside it, the map will be reloaded every time a post back in the UpdatePanel is done. The UpdatePanel changes the inner HTML content after AJAX post back. Thus it changes the Google Map container element (DIV) and that's why it is reloaded again.
Second, I have found a problem while working on the sample (again caused by the nature of UpdatePanel).If there is UpdatePanel on the page and even, if GoogleMap control is not inside the UpdatePanel, it was reloaded on every AJAX post back.

I have fixed that and now GoogleMap control has a property InsideUpdatePanel which have to be set explicitly to true when GoogleMap control is inside UpdatePanel.
I will update the release files and Sample Website tomorrow morning.

However, the live Sample Website was updated and you can see the sample here .

I'm just generating random markers there and using UpdatePanel, but GoogleMap control is not inside it.
You can use with same result and if you prefer Page Methods as well.

Apr 1, 2008 at 2:02 AM
hi, thanks for the update.
i downloaded the latest release DLL, added the insideupdatepanel property, but get the following javascript error

"artem is undefined"

any ideas?
Apr 1, 2008 at 7:05 AM
Please, send me, if possible, some details of the code you using the GoogleMap control to re-produce the problem.

Apr 1, 2008 at 4:23 PM
hi velio

it works now (something wrong with my other pc, i guess).
i get a slight flicker, though....

i am in an ASCX in DNN.

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

<artem:GoogleMap ID="GoogleMap1" runat="server" Width="560px" Height="560px"
InsideUpdatePanel="true" EnableScrollWheelZoom="true" EnableDoubleClickZoom ="true" Zoom="12">

<asp:Timer ID="Timer1" runat="server" Interval="30000" OnTick="Timer1_Tick">

<asp:Label ID="Label1" runat="server" Text="not refreshed yet."></asp:Label>
<asp:Label ID="lblError" runat="server" CssClass="Error"></asp:Label>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<asp:LinkButton ID="lbHistory" runat="server" CssClass="Small" OnClick="lbHistory_Click">Show My History</asp:LinkButton>
<asp:LinkButton ID="lbDisableTimer" runat="server" CssClass="Small" OnClick="lbDisableTimer_Click">Disable the Timer</asp:LinkButton>

Apr 2, 2008 at 12:13 AM
maybe you can just post the example code, instead.
Apr 2, 2008 at 6:51 AM
Edited Apr 2, 2008 at 6:54 AM
The you can see the working example here
And the entire code can be found in GoogleMap Control 3.2 Sample Website release file - page GoogleMapClientUpdate.aspx.