Clientside addMarker- fails on PostBack?

Oct 30, 2008 at 10:19 PM
Hi,

Great control- I've found it really useful so far. I've got a small problem, though. I'm adding a marker by Javascript (which works, and appears on the map) with the following:

var cursorPoint = new GPoint(this.xPos,this.yPos);
this.mapInstance.addMarker({
            Latitude: this.mapInstance.fromContainerPixelToLatLng(cursorPoint).lat(),
            Longitude: this.mapInstance.fromContainerPixelToLatLng(cursorPoint).lng(),
            Draggable: true,
            Bouncy: true,
            Text: "sdfsdf"
});
this.mapInstance.render();

So far so good. Marker appears on the map. But when I click on a Button that fires a postback, I get the following:

Requested value 'undefined' was not found.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Requested value 'undefined' was not found.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: Requested value 'undefined' was not found.]
   System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) +7530687
   Artem.Web.UI.Controls.JsonSerializer`1.ParseValueString(String value, Type type) +1371
   Artem.Web.UI.Controls.JsonSerializer`1.AssignProperty(Object resultObject, String property, String value) +276
   Artem.Web.UI.Controls.JsonSerializer`1.ParseObject(StringReader reader, Object obj, Boolean recursiveCall) +1457
   Artem.Web.UI.Controls.JsonSerializer`1.ParseObject(StringReader reader, Type type, Boolean recursiveCall) +78
   Artem.Web.UI.Controls.JsonSerializer`1.ParseArray(StringReader reader, Type arrayType) +177
   Artem.Web.UI.Controls.JsonSerializer`1.ParseObject(StringReader reader, Object obj, Boolean recursiveCall) +541
   Artem.Web.UI.Controls.JsonSerializer`1.Deserialize(String jsonText, T value) +100
   Artem.Web.UI.Controls.GoogleMap.LoadGoogleMapState(String state) +65
   Artem.Web.UI.Controls.GoogleMap.OnInit(EventArgs e) +83
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378


Any ideas where I've gone wrong?
Jan 4, 2009 at 1:55 PM
Hi,

I have the same issue that bothers me, when i click a button on the page i ve got the same error page. Even though i have used googlemap successfuly in my previous project , i couldn't get it worked even if i did all the same.
I realize that if you use <asp:LinkButton> instead of <asp:Button> <asp:ImageButton> you cant get markers. take attention to this.

Or you can try to right click on your solution and click "Clean Solution" then "Build Solution" again to fix things up.

I use the code below to get markers;

function addMarker(overlay, point) {
            var map = <%= GoogleMap1.ClientMapID %>;
            if(point) {
                map.addMarker({Latitude: point.lat(), Longitude: point.lng()});
                map.Markers[map.Markers.length - 1].load(point);
            }
        }

Jan 4, 2009 at 2:33 PM
I get over this silly issue by using the older assembly GoogleMap 3.2 i guess.

Hope this helps to you, too