Author: rspiet | Posted on: 9/4/2008 7:50:32 AM | Views : 266

I've seen client side javascript where you reference a control by something like this:
var DaysOff = document.getElementById('<%= txtDaysOff.ClientID %>').value;

But what if you want to build the string "txtDaysOff" dynamically in your javascript function. How would you get the ClientID in this case? Say I have 10 <asp:textbox controls with id="txtNumber1", id="txtNumber2" etc., and I want to add the values in all of them. I would like to do something like the following, but I don't know the syntax required to do this. Can somebody please help me out?

function AddNumbers() {
   var i = 0, controlID = "", Sum = 0;
  
   for (i = 0; i < 9; i++) {
   ...

Go to the complete details ...