KingPacino
Programmer
I have an asp:checkboxlist dynamically filled with values in c#, I need a javascript function to go through the checkboxlist items and if it is checked then put the value of the checkboxlist item into a textbox, I have found a function that seems to loop through the items ok but actually extracting the value of each checkboxlist item is proving very difficult for me.
Here is what I have, it is a kind of work around but is doing something vaguely similiar to what I want -
any ideas would be very welcome, a lot of the solutions I have found on the net seem to be for the standard checkbox but have found very little so far as asp:checkboxlists'.
Thanks
Here is what I have, it is a kind of work around but is doing something vaguely similiar to what I want -
Code:
var controlIndex;
var element;
var numberOfControls = document.Form1.length;
for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
{
element = document.Form1[controlIndex];
if (element.type == "checkbox")
{
if (element.checked == true)
{
//A test to see if working
//alert("Test"+element.value);
}
}
}
any ideas would be very welcome, a lot of the solutions I have found on the net seem to be for the standard checkbox but have found very little so far as asp:checkboxlists'.
Thanks