Javascript:
function selectall(cb_selall)
{
if (cb_selall.checked)
{
for(i=0; i<document.form1.li_mana_cards.options.length; i++)
{
document.form1.li_mana_cards.options[i].selected = true;
}
}
else
{
for(i=0; i<document.form1.li_mana_cards.options.length; i++)
{
document.form1.li_mana_cards.options[i].selected = false;
}
}
var s=document.getElementById('li_mana_cards');
CountItems(s);
}
function CountItems(lb) {
var count = 0;
var lbl=document.getElementById('lbl_selected');
for (var i = 0; i < lb.options.length; i++)
{
if (lb.options[i].selected) {
count++;
}
}
document.getElementById('lbl_selected').innerHTML=count;
}
Page Load:
cb_red_inac.Attributes.Add("onclick", "javascript:selectall(this);")
li_mana_cards.Attributes.Add("onchange", "javascript:CountItems(this);")