How to get ControlID when placed in Content place holder of master page

Z

Zdenko

Hi,

I have few texboxes on web page and java script code which manipulates with
content of those text boxes. Everything works fine.
Problem arises when I put web page inside content placeholder of master
page. Depending on content place holder ID of control is changed. It becomes
something like Ctrl000$txtIput.
More interesting thing that same name pattern is not used when dynamic
control is added to page. In page load I am dynamicaly adding few text
boxes.
Name change is understandable, to avoid duplicate IDs.
I have to get ID of content place holder of master page (inside it runs my
web page) and modify JavaScript on the fly:
This works in standalone web page:
var obj = document.getObjectbyID("txtAddress1");
When master page is used code has to be cjanged to:
var obj = document.getObjectbyID("Ctrl000$blabla$txtAddress1");
And if control was dynamicaly created:
var obj = document.getObjectbyID("Ctrl000blablatxtAddress1");

How to get decorated name of the control?

Bigest problem is that I am using separate source files for JavaScript. I
know that I can declare variable in .js file (Ex.var txtName1;) and create
JS part of page which will assign dynamicaly name of the control.
Is there any better way?

Zdenko
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top