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.
$('#<%= gdvRegretletter.ClientID %>...')It fails if you move the code to it's own JS file. Use an anonymous css class:<asp:GridView id="gdvRegretletter" class="gdvRegretletter" ...>and alter jquery to$('table.gdvRegretletter input[type='checkbox']:checked')