Using Javascript in ASP.NET User Control

Hello,
I have a usercontrol with a textbox in that I need to perform a javascript function on. The function (SpellCheck) is contained within the control and can be called by the parent page and can be run on parent elements, but my problem comes when I try to run the function for textboxes in the usercontrol.
I get an error saying the object (the textbox on the usercontrol) is null or not an object.

Is there any way of referencing the textbox on the usercontrol via the control itself? Please see below for code

Thanks in advance,
mcg

'CODE:
 Page.RegisterStartupScript("spellCheck", "<script language='JavaScript'>document.getElementById('txtBox').value = SpellChecker(document.getElementById('txtBox').value);</script>")
LVL 6
mcgantsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Elvio Lujan.Net Senior DeveloperCommented:
use...

Page.RegisterStartupScript("spellCheck", "<script language='JavaScript'>document.getElementById('" & txtBox.ClientId & "').value = SpellChecker(document.getElementById('" & txtBox.ClientId & "').value);</script>")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mcgantsAuthor Commented:
you're officially a star :D
that's been plaguing me for hours!!!

cheers,
mcg
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.