This is a migrated thread and some comments may be shown as answers.

XmlHttpPanel do not show google map

1 Answer 113 Views
XmlHttpPanel
This is a migrated thread and some comments may be shown as answers.
Nattapone
Top achievements
Rank 1
Nattapone asked on 21 Nov 2011, 11:08 AM
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

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 22 Nov 2011, 11:34 AM
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
Tags
XmlHttpPanel
Asked by
Nattapone
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or