I am trying to get the selected value (or values) of the checkboxlist. My problem is that I am binding the checkboxlist in c# and it's not rendering with the "Value" attribute as it would if I were to hard code the
<asp:ListItem Value=".." .. />
My checkboxlist looks like this:
<asp:CheckBoxList runat="sever" ID="cblStuff" DataValueField="myID" DataTextField="myName"></asp:CheckBoxList>
So when I try to use jquery and do the follow, it returns only "on" as apposed to "myID". Am I missing something? I was under the impression that is what the DataValueField was for? Here is the js I am using:
$("checkboxlist selector").change(function() {
$(this).find(":checked").each(function() { alert($(this).val()); });
});
Thanks.