HI,
I have an aspx page that has a table of both html checkboxes and various asp server controls (some of which are also check boxes). I gave each of the controls an id of btn_1 thru btn_52. btn_1 thru btn_32 are the html checkboxes. btn_33 thru btn_52 are the server controls. I migrated the table from the aspx to a user control. I then placed the user control within a raddock that resides on a different aspx. I have a few javascript functions (contained in the user control ascx file) that manipulates attributes of the controls once rendered on the client. Now that the controls are contained within a user control that is contained within a raddock, I realize that I have to do some drilling down to get a reference to the server side controls on the client. References to the HTML controls do not seem to be a problem. For example: I can obtain a reference to btn_1 (an html checkbox) via: var oChk = document.getElementById('btn_1'). But if I want to get a reference to btn_33 ( a server side checkbox), I have to do it with:
var oChk = document.getElementById("RadDock1_C_ToothPicker1_" + 'btn_33'). I figured this out by "viewing the source code" after the page was rendered. Is there a more genric way to do this? I cannot always be certain that my instance of raddock will always be RadDock1 on any given page. I cannot be certain that my instance of my user control will be ToothPicker1 on any given page.
below please find a sample of my javascript from this project.
<pre>
function
AllClear(oButton) {
// adult teeth
var tt = 0;
for (tt = 1; tt <= 32; tt++) {
var oChk = document.getElementById('btn_' + tt)
oChk.checked =
false;
}
// baby teeth
tt = 0;
for (tt = 33; tt <= 52; tt++) {
var oChk = document.getElementById("RadDock1_C_ToothPicker1_" + 'btn_' + tt)
oChk.checked = false;
}
return false;
}
</pre>