Good Afternoon , I have collection of checkboxes under Listview .
Can u suggest me how to pass the count of checked and unchecked checkbox items . Label count has to be updated when checkbox is checked or unchecked .
My code
<ItemTemplate>
<li>
<p style="text-align: left; padding: 3px;">
<asp:Label ID="lblName" runat="server" Text='<%#Eval("Title")%>' CssClass="imglbl" /><br />
<img src="<%#Eval("ThumbNail")%>" style="vertical-align: middle;" height="120" width="110" id="myimg" title="Click to Play" /><br />
<asp:Label ID="lblpricetag" Text="Price($):" runat="server" Style="float: left; display: inline; margin-top: 8px;" /><asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price")%>' CssClass="imgprice" /><br />
<br />
<%--<input type="checkbox" id="chkaddtocart" value='<%#Eval("id")%>' name="chkaddtocart" onchange="chkonclick(this.checked,this.value);" />Add to Cart--%>
<asp:CheckBox ID="chkaddtocart" runat="server" Onclick=function() Text="Add to Cart" />
</p>
</li>
</ItemTemplate>
I got it in script but i want it in codebehiend
this is my script code
function chkonclick(o,chkvalue) {
//alert(o + "," + chkvalue);
if (o) {
myitems += 1;
}
else {
if (myitems > 0)
myitems -= 1;
else
myitems = 0;
}
myitemslabel = myitems + " items";
$("#txtitems").val(myitems.toString());
$("#lblitems").html(myitemslabel);
}
txtitemstxtitems? if so your code should work.Label count has to be updated when checkbox is checked or uncheckedwhat is this Label? Please edit your code with those markup