Error: Object expected- Version 6 control

Mar 4, 2013 at 12:47 PM
Hi,

Something very weird is happening. First I've tried using this control on a very simple form. Just a Button and the Artem:GoogleMap control inside a <div> that has its Visible property set to false. The idea is to show the map, according to latitude and longitude parameters that are obteined when the button is clicked. I've accomplished this with the following code:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm2.aspx.vb" Inherits="GoogleMaps_SubGurim.WebForm2" %>
<%@ Register assembly="Artem.Google" namespace="Artem.Google.UI" tagprefix="artem" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>GoogleMaps - Using Artem Control</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" />
        <asp:Button ID="Button1" runat="server" Text="Show map" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div id="divMap" runat="server" visible="false">
                    <artem:GoogleMap ID="GoogleMap" runat="server" Width="952px" Height="230px"/>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>    
    </div>
    </form>
</body>
</html>
The code-behind is as following:
Imports Artem.Google.UI

Public Class WebForm2
    Inherits System.Web.UI.Page

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

    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim lat As Double = -22.5322
        Dim lng As Double = -44.635899999999999
        Dim marcaTorre As New Marker
        Dim posicao As New LatLng(lat, lng)
        marcaTorre.Icon = "../Imagens/Torre_PR.png"
        marcaTorre.Position = posicao
        GoogleMap.Center = posicao
        GoogleMap.Key = "myGoogleAPIKey"
        GoogleMap.EnableScrollWheelZoom = True
        GoogleMap.EnableMapTypeControl = True
        GoogleMap.Zoom = 15
        GoogleMap.Markers.Add(marcaTorre)
        divMap.Visible = True
    End Sub
End Class
In this case the webform is not attached to any Masterpage and it works pretty fine, as desired. When button is clicked the map is shown.

So I've became encouraged to move on and use in my web application. This web application has a MasterPage. The webform in which I'm using the Artem Control has a few <div>tags that are shown (or not) depending on some conditions (doesn't matter) and has also a UpdatePanel. So, as in the simple application before, I have the Artem Control inside a <div> tag that has its Visible property set to false. And, also, there's a button that must be clicked to the map be showed. But in this scenario, things don't work. When I click the button (to show the map) I get this error:
return a?new google.maps.LatLng(a.lat,a.lng):null

The Source for my application is as following:
<%@ Page Title=".: Análise de Falhas em LTs - DRN.O :." Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="frmAnaliseFalha.aspx.vb" Inherits="Interface_Web.frmAnaliseFalha" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Register assembly="Artem.Google" namespace="Artem.Google.UI" tagprefix="artem" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div id="divDadosFalha" style="border: 1px solid #496077;">
            </div>
            <div id="divAnaliseFalha" runat="server" style="border-bottom: 1px solid #496077; border-left: 1px solid #496077; border-right: 1px solid #496077; margin-top: 10px;">
                <table>
                    <tr>
                        <td style="width: 110px;">Torre provável</td>
                        <td style="width: 850px;">Intervalo para inspeção 
                            <asp:Button ID="btnMap" runat="server" Text="Show Map" /></td>
                    </tr>
                </table>
            </div>
            <div id="divMap" runat="server" visible="false" style="border-bottom: 1px solid #496077; border-left: 1px solid #496077; border-right: 1px solid #496077; padding-top: 3px; text-align: center; border-bottom: 3px;">
                <artem:GoogleMap ID="mapaTorre" runat="server" Width="952px" Height="230px"/>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
The code-behind for the button is:
    Private Sub btnMapa_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnMapa.Click

        Dim lat As Double = -22.3355 
        Dim lng As Double = -44.453 
        Dim posicao As New LatLng(lat, lng)
        Dim marcaTorre As New Marker
        marcaTorre.Icon = "../Imagens/Torre.png"
        marcaTorre.Position = posicao
        mapaTorre.Center = posicao
        mapaTorre.Key = "my GoogleMaps API key"
        'mapaTorre.EnableScrollWheelZoom = True
        mapaTorre.EnableMapTypeControl = True
        mapaTorre.Zoom = 15
        mapaTorre.Markers.Add(marcaTorre)
        divMap.Visible = True
    End Sub
Of course I have Imports Artem.Google.UI in the code behind as well.

Why does it work in the simple application and does not in my application? It's driving me crazy for many days.

Thanks for your attention.

Paulo Ricardo Ferreira
Rio de Janeiro - Brasil