Loop through gridview using jquery

I'm trying to loop through gridview using jquery, the code I'm using is

$('#<%=gridview1.clientid%> tbody tr').not(':first,:last')
  .each(function(){
    gridrows ++;
  });

I would like to remove the first and last rows, which obviously are the header and footer, I tried this code, but it doesn't seem to work, it returns the number of gridview rows. any ideas.

+3
source share
2 answers

Two things are possible:

(1) Try not to mix server code in your jquery. Just use the gridview ID $ ('# myGridView') property instead of going through the brackets. (Maybe you did not try to do this.)

(2) Read Rick Strall's post on this topic. http://www.west-wind.com/weblog/posts/822827.aspx

, , , .

+1

<tbody>, <thead> <tfoot> ?

<table>
  <thead><tr>..</tr></thead>
  <tbody><tr>..</tr></tbody>
  <tfoot><tr>..</tr></tfoot>
</table>

?

.not(). , , ASP.net ?:)

0

Source: https://habr.com/ru/post/1787267/


All Articles