Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > XmlHttpPanel > XmlHttpPanel do not show google map

Not answered XmlHttpPanel do not show google map

Feed from this thread
  • Nattapone avatar

    Posted on Nov 21, 2011 (permalink)

    Hi. I have problem about showing google map in XmlHttpPanel. I have google map control from http://th.googlemaps.subgurim.net/

    This is .aspx page
    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <%@ Register assembly="GMaps" namespace="Subgurim.Controles" tagprefix="cc1" %>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server"
            EnableClientScriptEvaluation="True"
            onservicerequest="RadXmlHttpPanel1_ServiceRequest">
            <asp:Label ID="Label1" runat="server"></asp:Label>
            <cc1:GMap ID="GMap1" runat="server" Width="920px" Height="452px" />
        </telerik:RadXmlHttpPanel>
        <br />
    <br />
    <br />
    <input type="button" value="Set Value" onclick="SetValue();return false;" />
    <script type="text/javascript">
        function SetValue() {
            var panel = $find("<%=RadXmlHttpPanel1.ClientID %>");
            panel.set_value("555");
        }
    </script>
        <%--<cc1:GMap ID="GMap1" runat="server" Width="920px" Height="452px" />--%>
    </asp:Content>

    This is aspx.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Subgurim.Controles;
     
    public partial class Test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        
     
        }
        protected void RadXmlHttpPanel1_ServiceRequest(object sender, Telerik.Web.UI.RadXmlHttpPanelEventArgs e)
        {
            Label1.Text = "Label updated by XmlHttpPanel callback at: " + DateTime.Now.ToString();
            //access the callback value from the client on the server using the e.Value property
            Label1.Text += "<br/> The returned value fron the client's set_value() function is: <strong>" + e.Value + "</strong>";
     
            GMap1.Version = "2";
            GMap1.enableDragging = false;
            GMap1.enableGoogleBar = false;
            GMap1.Language = "th";
            GMap1.setCenter(new GLatLng(13.7729, 100.4857), 14);
            GMap1.enableHookMouseWheelToZoom = false;
            //GMap1.mapType = GMapType.GTypes.Hybrid;
            GMap1.addControl(new GControl(GControl.preBuilt.MapTypeControl));
            GMap1.enableRotation = true;
            GMap1.enableDragging = true;
        }
    }

    Problem: At first page load google map can be display but when i click button google map can't display (background is gray colour). You can see image in attach file.


    Please advise.
    Thank you for your help.
    Nott

    Reply

  • Pero Pero admin's avatar

    Posted on Nov 22, 2011 (permalink)

    Hi Nott,

    The issue seems to be caused by the fact that the GMap control you are using is dependent on the client lifecycle of the page, which does not occur when the XmlHttpPanel updates its content. What XmlHttpPanel does is, it receives HTML from the server or a web service, and appends it to the DOM tree. If there are <script> tags it evaluates them, but it does not in any case follow the standard client lifecycle.
    Please verify that the GMap control can be used in AJAX scenarios, and try using the RadAjaxPanel instead.

    Regards,
    Pero
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > XmlHttpPanel > XmlHttpPanel do not show google map