All runtime setting lost on Postback.

Mar 4, 2013 at 2:51 PM
I am using the 6.1 control.
All setting made during pageload, like Latitude, Longitude, Zoom, and Marks are lost on a postback.
If I set the same setting during page design then each value is remembered.

My example has a map and a button. The map location, zoom and one mark are set during page load, the button click is just moving the location. On button click everything is gone!

Could someone tell me what I'm doing wrong.

Here is my code:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication2._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register assembly="Artem.Google" namespace="Artem.Google.UI" tagprefix="artem" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"> <title></title> </head> <body>
<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>
    <asp:Button ID="btnMaple" runat="server" Text="Maple Grove" />
    <br>
    <artem:GoogleMap ID="GoogleMap1" runat="server" MapType="Roadmap" />
    <artem:GoogleMarkers ID="GoogleMarkers1" TargetControlID="GoogleMap1" runat="server">
    </artem:GoogleMarkers>

</div>
</form>
</body>
</html>

Imports Artem.Google.UI

Public Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Not IsPostBack Then
        GoogleMap1.Latitude = 44.97681
        GoogleMap1.Longitude = -93.265811
        GoogleMap1.Zoom = 11

        Dim mark As New Marker
        mark.Position = New LatLng(44.97681, -93.265811)
        mark.Info = "This is a Mark"

        GoogleMarkers1.Markers.Add(mark)
    End If
End Sub

Private Sub btnMaple_Click(sender As Object, e As System.EventArgs) Handles btnMaple.Click
    GoogleMap1.Latitude = 45.1255339
    GoogleMap1.Longitude = -93.4509124
End Sub