Saravana Kumar

Saravana Kumar

  • NA
  • 374
  • 6.3k

Get the checked checkbox list order using javascript

Jan 12 2017 2:07 AM
i have one grid with One CheckBox and textbox. i want to get the checkbox checked order in the textbox. My code is shown below. Any one can help me??
 
 
function GenerateOrderNo() {
var GridView = document.getElementById('<%=grvbatch.ClientID %>')
var Order;
var cellToCheck;
var cellToAssign;
var count = 0;
if (GridView.rows.length > 0) {
alert(GridView.rows.length);
for (Row = 1; Row < GridView.rows.length; Row++) {
txtOrder = GridView.rows[Row].cells[1].childNodes[Row];
cellToCheck = GridView.rows[Row].cells[0];
if (cellToCheck.childNodes[Row].type == "checkbox") {
if (cellToCheck.childNodes[Row].checked == true) {
// alert("Yes");
Order = Row + 1;
alert(Order);
txtOrder.value = Order;
// alert(Order);
}
else {
txtOrder.value = "";
}
}
}
}
}
</script>
 

Answers (2)