This project is read-only.

All runtime setting lost on Postback.

Mar 4, 2013 at 3: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" "">

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

<html xmlns="">
<head runat="server"> <title></title> </head> <body>
<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />

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


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"

    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