2

Am having a little confusion. I have an external javascript file in my project under the Scripts folder named as Hierarchy.js... This external jscript file contains some 3-4 different functions with one being KeySelected. Now I need to call this very function in the OnClientItemSelected property of an AJAX autocomplete extender in a user control inside the folder named as User Controls.

Will this work :

OnClientItemSelected="KeySelected" 

Or do i need to write the whole path? Also, a thing to note, folders Scripts and User Controls are in the same project.

Suggestions and assistances are highly appreciated.

-Anurag

2 Answers 2

2

Make sure the the Hierarchy.js is linked to the document:

<script type="text/javascript" src="yourPath/Hierarchy.js"></script>

You don't need to use any "path" to point the KeySelected function, all functions (if not part of other object) are loaded to global namespace, so OnClientItemSelected="KeySelected" should work.

See this article: Using the AutoComplete Extender

Sign up to request clarification or add additional context in comments.

Comments

0

No, when you are sure the external JavaScript file is loaded you can call those functions just by specifying there names. If your code is evaluated and your function doesn't exist yet, but you're sure it will exist when the AJAX-call completes wrap it inside a function.

OnClientItemSelected = function() {KeySelected();}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.