• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

External Javasctipt function not finding object on page.

Hi

I have a grid with a timer to force an AJAX refresh. I have an external JS page with a function to open a pop up. This all works fine.

I have added the following to stop the timer on pop up

    var AjaxTimer = $find('<%= tmrGridRefresh.ClientID %>');
    AjaxTimer._stopTimer();
   'pop up code here...

This doesn't work. The problem is the Var AjaxTimer is always null.

If I copy the function out of the external file into the actual page it works OK.

Why is the $find('<%= tmrGridRefresh.ClientID %>'); not working when its in the external fle

Andy
0
Andy Green
Asked:
Andy Green
  • 2
  • 2
1 Solution
 
Tom BeckCommented:
0
 
Andy GreenAuthor Commented:
Thanks

So rather than use the $find to get the client ID, If I Know the ID form the page markup, can I use that?

Andy
0
 
Tom BeckCommented:
That can work. You can also add the JavaScript variable AjaxTimer and the $find to the head of the aspx page. Or, follow the suggestion in the link I provided and make your js file an aspx file containing nothing but JavaScript and a @Page directive. That way it will be processed by asp.net at runtime.
0
 
Andy GreenAuthor Commented:
Thanks for answer and follow up.

Andy
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now