aditya immadi

aditya immadi

  • NA
  • 215
  • 23.8k

check box list is not woking in my view

Oct 25 2016 3:00 AM
hai all i wrote this sample code for selecting check boxes in check box list my view is
 
for this i did like first i bind the tablle and attached to list
 
@{
List<SelectListItem> listcheck = new List<SelectListItem>();
foreach (DataRow row in dtcheck.Rows)
{
//listcheck.Add(new SelectListItem { Value = row["RoleID"].ToString(), Text = row["RoleName"].ToString() });
<input type="checkbox" name="selected" value="@row["RoleID"]" id="checked" />
@row["RoleName"]
}
}
and after
 
 
<script type="text/javascript" src="~/Scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.8.24.min.js"></script>
<script type="text/javascript" src="js/bootstrap-2.3.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap-multiselect.js"></script>
<script type="text/javascript">
$(document).ready(function () {
alert("Document ready");
//$("#somebutton").on("click", function () {
// alert("clicked");
// var v = $("#checked").val();
// var v = $('input[name=selected]:checked').val();
// alert(v);
//});
$('#checked').multiselect({
includeSelectAllOption: true
});
$("#somebutton").on("click", function () {
alert("button clicked");
alert($('#checked').val());
})
});
</script>
<button id="somebutton">forTestOnly</button>
 
the commented jquey is working however the one which i need in that not even button cick is not working can any one help me
 
Thanks and Regards 

Answers (2)