RadMap crashes inside UpdatePanel

5 posts, 0 answers
  1. Igor
    Igor avatar
    8 posts
    Member since:
    Nov 2014

    Posted 06 Nov 2014 Link to this post

    I have a RadMap inside a UpdatePanel along with other controls. There is only one RadMap.

    However, while navigating (using AJAX, UpdatePanel), starting at the second call I get this error:

    0x800a139e - JavaScript runtime error: Sys.InvalidOperationException: Two components with the same id 'radWorldMap' can't be added to the application.

    Any help?

    Thank you.
  2. Igor
    Igor avatar
    8 posts
    Member since:
    Nov 2014

    Posted 22 Jan 2015 in reply to Igor Link to this post

    This looks like a bug. The solution was to dynamically add the RadMap control when it's needed, instead of a regular markup inside UpdatePanel (as all other controls are).
    Disappointing nobody from Telerik replied to this issue after many months.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lee
    Lee avatar
    5 posts
    Member since:
    Jan 2008

    Posted 04 Feb 2015 in reply to Igor Link to this post

    Hi,

    I'm experiencing the same issue, do you have some example code of this?

    My current code is looking like this and throwing the same error

    <asp:UpdatePanel id="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <telerik:RadMap runat="server" ID="RadMap1" Zoom="2" Height="600px" MinZoom="2" MaxZoom="2" Pannable="false" >
                <ClientEvents OnShapeCreated="shapeCreated" OnShapeMouseEnter="shapeMouseEnter" OnShapeMouseLeave="shapeMouseLeave" />
                <LayersCollection>
                    <telerik:MapLayer ClientDataSourceID="RadClientDataSource1" Type="Shape" Opacity="1" TitleField="name" >
                    </telerik:MapLayer>
                </LayersCollection>
                <CenterSettings Longitude="32" Latitude="7" />
            </telerik:RadMap>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="typeRadioList" />
        </Triggers>   
    </asp:UpdatePanel>

  5. Igor
    Igor avatar
    8 posts
    Member since:
    Nov 2014

    Posted 04 Feb 2015 in reply to Lee Link to this post

    As I said in my previous post, you have to remove the RadMap from your page and add it dynamically in your code-behind file (and set all your properties in the code-behind). Unfortunately nobody from Telerik ever replied to this thread and this was the only solution I could find.
  6. Lee
    Lee avatar
    5 posts
    Member since:
    Jan 2008

    Posted 05 Feb 2015 in reply to Igor Link to this post

    Hi, thanks for your response but I was really looking for an example of this if possible, the code I have for adding it server side is
    protected void Page_Load(object sender, EventArgs e)
    {
        Telerik.Web.UI.RadMap map = new Telerik.Web.UI.RadMap();
        map.ID = "RadMap1";
        map.Zoom = 2;
        map.Height = 600;
        map.MinZoom = 2;
        map.MaxZoom = 2;
        map.Pannable = false;
        map.ClientEvents.OnShapeCreated = "shapeCreated";
        map.ClientEvents.OnShapeMouseEnter = "shapeMouseEnter";
        map.ClientEvents.OnShapeMouseLeave = "shapeMouseLeave";
        Telerik.Web.UI.MapLayer mapLayer = new Telerik.Web.UI.MapLayer();
        mapLayer.ClientDataSourceID = "RadClientDataSource1";
        mapLayer.Type = Telerik.Web.UI.Map.LayerType.Shape;
        mapLayer.Opacity = 1;
        mapLayer.TitleField = "name";
     
        map.CenterSettings.Latitude = 7;
        map.CenterSettings.Longitude = 32;
        map.DataBind();
     
        MapPlaceholder.Controls.Add(map);
    }

    But what I'm experiencing is that the java script OnShapeCreated event is not being fired and therefore the map is blank

    Thanks
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017