Finding control in AJAX updatepanel using Javascript?

Hi!

I have a asp.net application with a dropdownlist and a textbox within an updatepanel. Depending on what is selected in the dropdownlist, the textbox will be shown or not using AJAX. I would like to find the Textbox control using Javascript when it is shown. The Textbox is drawn on the screen, but when I view the HTML source code, I can't find the control unless I reload the Page.  This probably has something to do with using AJAX, but it must be drawn somewhere if it is shown on the screen. I am quite new at both Javascript and AJAX so I hope someone could help, thanks!
haveabunAsked:
Who is Participating?
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.

divinewind80Commented:
What exactly are you wanting to do with the textbox in Javascript?  The reason I am asking is that you can do a fair amount of the same things by using the UpdatePanel without a postback...
0
haveabunAuthor Commented:
Hi, thanks for you're reply.
We have a javascript code which has an autocomplete functionality we would like to use. I know there is an Ajax autocomplete but because of some functions we use in the javascript autocomplete, and we use this in other places in the application which do not use AJAX. We would like to keep it consistent with other parts. If possible we would like to avoid doing a postback to find the control. Is it possible?
0
divinewind80Commented:
Well, in my experience, I have always had trouble when combining an UpdatePanel and Javascript.  Perhaps someone else has a comment on it, but I would suggest that you use the AJAX autocomplete if you are wishing to use Javascript.  Otherwise, if you are using Javascript for client-side activity, why do you need the UpdatePanel?  Have you considered switching the server-side events to client-side and doing everything but the (assuming you need one) postback through Javascript?
0

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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

haveabunAuthor Commented:
Thank you, I understand you're thoughts, but the customer want's the Javascript functionality there as well, and for consistency we did not want to have an AJAX version.
Had I built this from scratch I would never done it like this, but the update panel and Javascript was developed in different parts of the development. I have not developed the updatepanel, and it seems it is used for different both server and client side events, depending what you are looking at.
I thought it would have been an easy solution using the Javascript, but I was wrong. I'll look for another solution, but it seems we need to suggest the AJAX version to do this anyway, if someone does not have a solution to this?
I will just have to make it look like the Javascript version.
0
haveabunAuthor Commented:
Does not seem like anyone has an answer to my original question, so I rebuild the usercontrol instead of just adding some code to make tha changes work. And the javascript works now, on a closer look, the updatepanel was not really needed at all! Thanks for you're replies divinewind80, I took you're advise to look over the code an rebuild it so I have accepted you're solution.
0
haveabunAuthor Commented:
The solution was not really what I was looking for in the first place, but it pointed me in another direction, that I probably would have gone anyway if I did not get an answer. But with the answer from an expert I know that there is not an easy answer to the question.
0
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
.NET Programming

From novice to tech pro — start learning today.