带有更新面板的Google地图未显示 [英] Google Maps with update Panel Not Displaying

查看:84
本文介绍了带有更新面板的Google地图未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我在谷歌地图上工作,我已经成功地在我的网页上显示了它。我们有24小时的GPS记录数据。它包含经度和纬度。现在随着时间的推移,我必须在Google地图上填写每个不同时间戳上的标记。



我的逻辑:



我拍摄了& lt; big& gt; DIV& lt; / big& gt;在其中显示谷歌地图,分别为经度和纬度两个文本框。在Div脚本中加载谷歌地图的一个Java脚本如下:

Hi everyone!

I am working on Google Maps and I have successfully displayed it in my web page. We have 24 hours of GPS recorded data. It contains longitude and latitud., Now as the data changes along with time, I have to populate a marker on Google Map on every different time stamp.

My Logic:

I have Taken a <big>DIV </big> to Display Google Map in it, Two Text Boxes For Longitude and latitude respectively. one Java Script To Load Google Map in Div Script is as Follows

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="util.js"></script>
    <script type="text/javascript">

        var directionsDisplay; 
        var directionsService = new google.maps.DirectionsService();
        function initialize() {
            directionsDisplay = new google.maps.DirectionsRenderer();
           // Retriving Values From Text Boxes
            var slong = document.getElementById(''&lt;%= txtLong.ClientID %&gt;'').value;
            var sLati = document.getElementById(''&lt;%= txtLati.ClientID %&gt;'').value;
            var slongSV = 0;

            var myLatlng = new google.maps.LatLng(slong, sLati);
            var myOptions = {
                zoom: 16,
                center: myLatlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            }
            var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
            var marker = new google.maps.Marker
    ({
        position: new google.maps.LatLng(slong, sLati),
        map: map,
        title: ''Click me''
    });



以上代码工作正常:)



我的问题:



i在更新面板中有DIV,我已经采用了一个计时器,其中滴答我在文本框中加载新值但是当计时器刻录更新面板更新时Google Map Go不可见[原因没有默认值/如果默认值比它显示默认值]。



需要解决方案:



我想显示谷歌地图没有任何闪烁或平滑像我们在Android手机导航应用程序:P,我应该能够设置服务器端或代码背后的坐标



可以任何人帮我这个请


So Above Code Work Fine :)

My Problem:

i have DIV in update Panel and i have taken a Timer in which ticks i m loading new Values in Text boxes BUT When Timer Ticks Update Panel Updates And Google Map Go invisible [ Reason no Default Values/ If Defaults Values Than it shows that Default Value].

Need Of Solution:

I want to display that Google Map without any flickers or Smooth like we have in Android phones Navigation app :P, and i should be able to set The coordinates from Server Side or Code Behind

Can Any one Help me on this Please

推荐答案

您好我自己解决了



问题是我在Div中加载地图但是由于计时器
Hi I have solved it by myself

the problem was i was loading the map in Div but due to timer
AsyncPostBackTrigger

我的div丢失了数据,因为我的google变量是本地的,并且在函数之后没有被杀死我创建了map的全局对象并删除了ajax Timer并使用了Java setTimeOut(),而在其他函数中我更新了标记和坐标

my div was losing the data it was because my google variable was local and it was not killed after the function so i created global object of map and removed ajax Timer and used Java setTimeOut() and in other function i was updating the marker and coordinates


这篇关于带有更新面板的Google地图未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆