Solved

External Javasctipt function  not finding object on page.

Posted on 2013-01-14
4
225 Views
Last Modified: 2013-01-15
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
Comment
Question by:Andy Green
  • 2
  • 2
4 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 38774223
0
 
LVL 3

Author Comment

by:Andy Green
ID: 38774406
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
 
LVL 38

Expert Comment

by:Tom Beck
ID: 38775040
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
 
LVL 3

Author Closing Comment

by:Andy Green
ID: 38777275
Thanks for answer and follow up.

Andy
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now