Reimers.dk

.NET, AJAX and Google APIs brought together
Welcome to Reimers.dk Sign in | Join | Help
in Search

Parser Error

Last post 01-07-2010, 22:04 by CapnChaos. 6 replies.
Sort Posts: Previous Next
  •  10-01-2009, 21:22 2789

    Parser Error

     

    I'm using the control with Visual Web Developer 2008. After I drag the map on to the page and setup the key, the map will show when I run the a test. However, after I close the page and try again I get this Parser error:

    Parser Error Message: System.Collections.Generic.List`1[[ Reimers.Map.CustomMaps.GoogleMapType, GoogleMap, Version=4.2.0.82, Culture=neutral, PublicKeyToken=null]] must have items of type 'Reimers.Map.CustomMaps.GoogleMapType'. 'Reimers.Map.CustomMaps.GoogleNormalMap' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

    I haven't started playing with the code.

    Anyone know what I'm doing wrong?  Thanks

  •  10-01-2009, 23:41 2790 in reply to 2789

    Re: Parser Error

    Can you provide your markup?
  •  01-06-2010, 16:14 2935 in reply to 2790

    Re: Parser Error

    I get the same error from the control whenever I make any changes to the map. I can fix it by removing the three map types from the <MapTypes> node. But if you make changes to map, it puts them back in and the error reoccurs. This was only a small problem until today. I want to apply a CSS class to the map, but when I do it fills in those map types and causes the error. I remove the map types, but then my CSS class isn't applied...no idea why.

     I'm using the .dll that I compiled for .Net 2.0 from the source code available to download from the site (I cannot reach SVN from work) My code behind for the map is as follows:

    <Reimers:GoogleMap ID="GMap" runat="server" ContinuousZoomEnabled="True"
            DoubleClickZoomEnabled="True" MouseWheelZoomEnabled="true" Height="400px"
            Width="500px" CssClass="floatLeft">
    <Center Latitude="0" Longitude="0"></Center>

    <ClientSideHandlers OnAddMapType="" OnRemoveMapType="" OnClick="" OnRightClick="" OnMoveStart="" OnMove="" OnMoveEnd="" OnZoomEnd="" OnZooming="" OnMapTypeChanged="" OnInfoWindowOpen="" OnInfoWindowClose="" OnAddOverlay="" OnRemoveOverlay="" OnClearOverlays="" OnMouseOver="" OnMouseOut="" OnMouseMove="" OnDragStart="" OnDrag="" OnDragEnd="" OnLoad=""></ClientSideHandlers>

    <Options Version="Default" ShowLoaderImage="True" PassiveLogo="True" SuppressCopyright="False" DraggableCursor="" DraggingCursor="">
    <MapTypes>

    'These three lines cause the error. The designer says:  Element 'reimers.map.custommaps.googlenormalmap' is not supported.

    <Reimers.Map.CustomMaps.GoogleNormalMap ID="Normal Map" Name="Map">1</Reimers.Map.CustomMaps.GoogleNormalMap>
    <Reimers.Map.CustomMaps.GoogleSatelliteMap ID="Satellite Map" Name="Satellite">1</Reimers.Map.CustomMaps.GoogleSatelliteMap>
    <Reimers.Map.CustomMaps.GoogleHybridMap ID="Hybrid Map" Name="Hybrid">1</Reimers.Map.CustomMaps.GoogleHybridMap>
    </MapTypes>
    </Options>

    <Icons StateChanged="False"></Icons>
    </Reimers:GoogleMap>

     

  •  01-07-2010, 20:02 2937 in reply to 2935

    Re: Parser Error

    I think your problem is that the namespace is not registered on the page, so Intellisense doesn't give you the option to add the maps. Try adding these lines to your page declaration:

    <%@ Register Assembly="GoogleMap" Namespace="Reimers.Map" TagPrefix="Reimers" %>

    <%@ Register Assembly="GoogleMap" Namespace="Reimers.Map.CustomMaps" TagPrefix="Reimers" %>

     

    This should allow you to define map types like this:

    <Options>

    <MapTypes>

    <Reimers:GoogleHybridMap />

    <Reimers:GoogleNormalMap />

    </MapTypes>

    </Options>

    I tested it on my system and it works across postbacks. 

  •  01-07-2010, 20:35 2938 in reply to 2937

    Re: Parser Error

    That partially worked, but the designer now says "Attribute 'ID' is not a valid attribute of element 'GoogleNormalMap'." and it will not compile with the error "The 'ID' property is read-only and cannot be set."

    If I remove the ID and NAME attributes from the custom maps, the map will not render in the designer, but everything compiles correctly. It's not a big problem since everything works, but something seems wrong with the code the control inserts initially when adding the control. If the ID and Name are read only, the control shouldn't be adding those to the code.

  •  01-07-2010, 20:44 2939 in reply to 2938

    Re: Parser Error

    I don't think I understand. You shouldn't be setting the ID or Name values for normal map types. They are however needed to create JavaScript references which is why the control adds them.

    The map is not really intended to render in the designer.

  •  01-07-2010, 22:04 2940 in reply to 2939

    Re: Parser Error

    I'm not manually setting the ID or Name. When you add the map control (or make any changes to it) it inserts those map types in the form:

    <Reimers.Map.CustomMaps.GoogleHybridMap ID="Hybrid Map" Name="Hybrid"></Reimers.Map.CustomMaps.GoogleHybridMap>

    If I manually register the assembly: <%@ Register Assembly="GoogleMap" Namespace="Reimers.Map.CustomMaps" TagPrefix="Reimers" %>

    Then it will not compile because it says the ID and Name properties are read-only. 

    If I then manually remove the ID and Name it compiles fine and it doesn't overwrite those map types, so this is what I'm doing now. It works fine, but in the designer there is an error,

    Error Creating Control - GMap
    'Reimers.GoogleMap' could not be set on property 'Options'.

    But I'm just ignoring that and it works fine.

     

    Edit: This is just so you know and if anybody comes across this error, they know what to do. I'm using the control just fine despite the error in the designer. 

View as RSS news feed in XML