var chkBoxList = document.forms(0).items("nameofcheckboxlist");
for(i = 0; i < chkBoxList.length; i++)
{
if(chkBoxList[i].checked)
{
doWhatever();
}
}
Paul
"Bg" <noe...@here.com> wrote in message
news:uh282W6$CHA....@TK2MSFTNGP11.phx.gbl...
This is what you see if you view source from the browser (there are no
values anywhere even though I set them on the server side in the designer):
<table id="CheckBoxList1" onclick="GetCheckedValues();" border="0"
style="height:92px;width:211px;Z-INDEX: 112; LEFT: 19px; POSITION: absolute;
TOP: 14px">
<tr>
<td><input id="CheckBoxList1_0" type="checkbox" name="CheckBoxList1:0"
/><label for="CheckBoxList1_0">One</label></td>
</tr><tr>
<td><input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1:1"
/><label for="CheckBoxList1_1">Two</label></td>
</tr><tr>
<td><input id="CheckBoxList1_2" type="checkbox" name="CheckBoxList1:2"
/><label for="CheckBoxList1_2">Other</label></td>
</tr>
</table>
Te following example is something i've used to doWathever with the
value of a checkBox in a CheckBoxList in client side.
---------------------------------------------------------------------------
C# in server side:
( lstVarios is a CheckBoxList )
( btnHacer is a HTML Button )
---------------------------------------------------------------------------
string script = "";
script = "<script language='JAVASCRIPT'> \n";
script = script + "function buscarEnLista ( id ) { \n";
for (int i=0 ; i < lstVarios.Items.Count ; i++)
{
script = script + "\t if (id == 'lstVarios_" + i + "') return
'" + lstVarios.Items[i].Value + "'; \n";
}
script = script + "\t return 'ERR';\n";
script = script + "} \n";
script = script + "</script>\n";
Page.RegisterClientScriptBlock("_checkKey_", script);
btnHacer.Attributes.Add("onclick", "revisarBotones();");
---------------------------------------------------------------------------
---------------------------------------------------------------------------
JavaScript in client side:
( doWathever is a function that does wathever ;) )
---------------------------------------------------------------------------
function revisarBotones()
{
var hayObj = true;
var pp = new Object();
var i = 0;
while( hayObj == true )
{
pp = document.getElementById('lstVarios_' + i);
if (pp == null)
{
hayObj = false;
}
else
{
valor = buscarEnLista(pp.id);
doWathever( valor );
}
i++;
}
}
---------------------------------------------------------------------------
"Bg" <noe...@here.com> wrote in message news:<#aR3KHHA...@TK2MSFTNGP11.phx.gbl>...