asp.net 4.5 ajax库$Find不工作。

时间:2022-06-05 06:22:37

I recently upgraded from an older version of ASP.net (I believe 3.5) to 4.5. Now the ajax library method $find is not working in my javascript calls. I know the page has fully loaded before this occurs cause it's only on a user action that it calls the method.

我最近从一个旧版本的ASP.net(我相信3.5)升级到了4.5。现在,ajax库方法$find在我的javascript调用中不起作用。我知道页面在出现之前已经完全加载了,因为它只在用户操作上调用该方法。

Here is the code I am using:

下面是我使用的代码:

var parObj = $find('<%= lkpInput.ClientID %>');

So as you can see I am using the ClientID property to be sure it's the right ID. After this call parObj is null. Any help would be much appreciated.

你可以看到,我在使用ClientID属性确定它是正确的ID,在调用parObj之后是null。非常感谢您的帮助。

1 个解决方案

#1


0  

Could you place $find inside pageLoad event, and try again?

你能在pageLoad事件中找到$find,然后再试一次吗?

<script type="text/javascript">
   function pageLoad(sender, eventArgs) {
      var parObj = $find('<%= lkpInput.ClientID %>');
      console.log(parObj);
   }      
</script>

#1


0  

Could you place $find inside pageLoad event, and try again?

你能在pageLoad事件中找到$find,然后再试一次吗?

<script type="text/javascript">
   function pageLoad(sender, eventArgs) {
      var parObj = $find('<%= lkpInput.ClientID %>');
      console.log(parObj);
   }      
</script>