简体   繁体   English

从asp.net启用JavaScript功能

[英]enabled javascript function from asp.net

I have an ASP.NET application that must perform the following steps. 我有一个ASP.NET应用程序,必须执行以下步骤。

    • In the PaginaUno.aspx populates and displays a gridview and the user selects a row. 在PaginaUno.aspx中填充并显示gridview,然后用户选择一行。
    • Opens PaginaDos.aspx running a JavaScript and shows googlemap with the data collected in the PaginaUno.aspx 打开运行JavaScript的PaginaDos.aspx,并显示带有在PaginaUno.aspx中收集的数据的googlemap

Problem: that in step two shows object map but without markers. 问题:在第二步中显示了对象图,但没有标记。

I can not either automatically function pintamarkers() JavaScript activated by an event of ASP.NET) show the markers that I have defined. 我既不能自动运行由ASP.NET事件激活的pintamarkers()JavaScript,也不能显示我定义的标记。

Manual implementation works because I have defined in javascript on PaginaDos.aspx a button that runs pintamarkers() when you click and show the markers. 手动实现之所以有效,是因为我在PaginaDos.aspx的javascript中定义了一个单击并显示标记时运行pintamarkers()的按钮。

I have tried to: 我试图:

// body onload="pintamarkers()">

and sends the error 并发送错误

"Microsoft JScript runtime error: 'map' is null or not an object" “ Microsoft JScript运行时错误:'map'为空或不是对象”

How I can make the function pintamarkers() to run automatically when you load the PaginaDos.aspx ? 如何在加载PaginaDos.aspx时使pintamarkers()函数自动运行?

Thanks in advance for your answers. 预先感谢您的回答。

Looks like the map object hasn't loaded yet so .... 看起来地图对象尚未加载,所以....

Am I allow to use JQuery? 我可以使用JQuery吗? If so then 如果是这样

$(document).ready(function(){
    pintamarkers();
});

If not then check out this question 如果没有,请查看此问题

How to check if DOM is ready without a framework? 如何在没有框架的情况下检查DOM是否准备就绪?

but as you can see it will take a lot more code 但如您所见,它将需要更多代码

Edit 编辑

Just generally - i would imagine that the body onload would work. 只是一般而言-我想身体的负荷会起作用。 Could it be that you are calling pinttamarkers then initialising the map when the page loads ie have you got an initialise call embedded in the page that will run separately to the onload event 可能是您正在调用pinttamarkers然后在页面加载时初始化地图,即您是否在页面中嵌入了一个初始化调用,该调用将与onload事件分开运行

This question had something similar 这个问题有类似的东西

'__e3_' is null or not an object - google maps '__e3_'为空或不是对象-Google Maps

Anyway just another thought 无论如何,另一个想法

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

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