Gray map and JS Error when using Polyline events

Mar 9, 2010 at 3:03 PM

When I create any client side or server side Polyline events I get the following JavaScript errors and the map appears as gray rectangle.

Error: a[c] is undefined
Source File: http://localhost:64157/WebResource.axd?d=ctf12DmHSIfJAkpvNGm2Tll_HzbY0BJriFwvi1HbGxx8LQKIZOK0s0bMTpZNjcWI-3wNn_RJ67UvMM5hZt-pm5VqRYUJzMJbtQJvZ8OaCgI1&t=634037406540810421
Line: 1

All other events I've tested work as expected, it's only the polyline ones that are a problem.

Here is some code that reproduces the problem, using v4.1.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MapTest1.aspx.cs" Inherits="ReGenWebTest.MapTest.MapTest1" %>
<%@ Register tagprefix="gMap" assembly="Artem.GoogleMap" namespace="Artem.Web.UI.Controls" %>

<!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>Map test 1</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <gMap:GoogleMap 
            ID="gMap1"
            runat="server"
            PolylineEvents-OnClientClick="alert('test');"
            Width="100%" 
            Height="800px" 
            Latitude="54.95485"
            Longitude="-1.506414"
            Zoom="15"
            ShowTraffic="true"
            EnableMarkerManager="false"
            EnableScrollWheelZoom="true">
        </gMap:GoogleMap>
    </div>
    </form>
</body>
</html>

Thanks,
Alex

Mar 9, 2010 at 3:33 PM
Edited Mar 9, 2010 at 3:39 PM

I've found the cause of the problem in the source. Compare these sections of code, i does not exist in the current 4.1 release.

broken

 

    attachEvents: function Artem$Web$GooglePolyline$attachEvents(events, clients) {
if (events) {
var key = events[i].Key;
for (var i = 0; i < events.length; i++) {

if (clients) {
GEvent.addListener(this.GPolyline, key,
Function.Delegate.createFromString(this, events[i].Handler));
}
else {
var handler = events[i].Handler;
var delegate = Function.Delegate.create(this, this.raiseEvent);
GEvent.addListener(this.GPolyline, key, function(args) {
delegate.call(this, handler, args);
});
}
}
}
},

fixed

 

 

attachEvents: function Artem$Web$GooglePolyline$attachEvents(events, clients) {
if (events) {
var key;
for (var i = 0; i < events.length; i++) {
key = events[i].Key;

if (clients) {
GEvent.addListener(this.GPolyline, key,
Function.Delegate.createFromString(this, events[i].Handler));
}
else {
var handler = events[i].Handler;
var delegate = Function.Delegate.create(this, this.raiseEvent);
GEvent.addListener(this.GPolyline, key, function(args) {
delegate.call(this, handler, args);
});
}
}
}
},

 

Alex

Coordinator
Mar 11, 2010 at 6:40 AM

Thanks a lot Alex.
It is fixed in the my source code already, and will be properly implemented in the next release.

Regards