Reputation: 2175
Hi I am developing the asp.net application with javascript. I have one gridview with checkbox for each row. I have one button below. On clicking upon that button I am displaying values of only checked rows. I am looping through each row of gridview. I am trying as below.
var second = [];
$('#<%= gdvRegretletter.ClientID %> input[type="CheckBox"]').each(function () {if($(this).closest('tr').find('input[type="checkbox"]').prop("checked") == true)
second.push($(this).val());
});
If there are three checked checkboxes in the gridview I will get three times on on alert. I want to display Name column values. May I get some idean on this or May i know where I am going wrong? Thank you all.
Upvotes: 0
Views: 447
Reputation: 2496
You can directly get all checked entries like this
var second = [];
$('#your_id :checked').each(function() {
second.push($(this).val());
});
Upvotes: 1