I'm new for asp.net and now using control asp:Repeater. I want to implement follow table by Repeater:
index Name Delete
1 DDD X
2 EEE X
3 FFF X
Now the index is auto generate by set <%# (Container.ItemIndex+1) %> in asp.net page.
My question is below:
when I click 'X' to remove TableRow by JS method. How to make the column index value refresh? But sadly, the column idx become below:
index Name Delete
1 DDD X
3 FFF X
Thanks in advance.
Since you're removing it via a javascript. just hook into that and add a piece of code that reseeds your indices
// sample reseeding code
$('button').on('click', function() {
$(this).closest('tr').remove();
$('table').find('tbody').find('tr').each(function(i) {
// update the value of the index column
$(this).find('td').first().text(i + 1);
});
});