简体   繁体   English

Google map api不支持回发

[英]Google maps api not working on postback

I am using google maps API to load streets in a textbox.It is working properly.My problem is that on postback the initialize method in javascript is not working and data is not loading 我正在使用谷歌地图API加载文本框中的街道。它工作正常。我的问题是在回发javascript中的初始化方法不起作用,数据没有加载

I am using 我在用

function initialize() {
            //my code
             }
             google.maps.event.addDomListener(window, 'load', initialize);

Please help me 请帮我

You will need to re-initialize the map on post-back as the code will not run again. 您需要在回发时重新初始化地图,因为代码不会再次运行。 If you are using an UpdatePanel a way to do this would be to bind to the end_RequestHandler ie 如果您正在使用UpdatePanel,那么执行此操作的方法是绑定到end_RequestHandler

var prm = window.Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(endRequestHandler);

function endRequestHandler()
{
    // Initialize the map again
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM