Click here to Skip to main content
15,891,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i bound checkbox list in server side but now i want to get value in java script/jquery. On client side value attribute are not looking of checkbox,
how can i get checkboxlist checked/unchecked checkbox value.'

Thank you in advance.
Pawan Sharma
Posted

 
Share this answer
 
Comments
Pawan Sharma Software Engineer 17-Dec-12 2:45am    
Thank you for reply but by this link is not usefull for get server side value which bind with checkbox
i found solution:-

We should bind attribute "hiddenvalue" the it will be bind with server side value
and it will be found client side like

item.Attributes.Add("hiddenValue", item.Value);

C#
$("#<%= CheckBoxList1.ClientID %> input:checkbox:checked").each(function() {
   var label = $('label[for=' + this.id + ']').html();
   var value = $(this).parent().attr('hiddenValue');

   labels += label + ", ";
   values += value + ", ";
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900