protected void Page_Load(object sender, EventArgs e)
{
foreach (ListItem li in cblListItems.Items)
li.Attributes.Add("mainValue", li.Value);
}
Then call the below javascript function on click of checkboxlist.
function GetCheckBoxListValues(chkBoxID)
{
var chkBox = document.getElementById(chkBoxID);
var options = chkBox.getElementsByTagName('input');
var listOfSpans = chkBox.getElementsByTagName('span');
for (var i = 0; i < options.length; i++)
{
if(options[i].checked)
{
alert(listOfSpans[i].attributes["mainvalue"].value);
}
}
}
No comments:
Post a Comment