jQuery Filtering Gridview Columns

Posted by RSchmitt on Stack Overflow See other posts from Stack Overflow or by RSchmitt
Published on 2010-06-18T12:51:51Z Indexed on 2010/06/18 12:53 UTC
Read the original article Hit count: 518

Filed under:
|

I'm looking to have a click event for all columns but the last column of a GridView and then have a separate click event for the last column of the gridview (a DropDownList). I have the following right now but just can't seem to get it to exclude the last column:

var _activeRow;
$('.gridview-jquerify tr').filter(function() {
     return $('td', this).length && !$('table', this).length
})
.bind('click', function(e) {
     if (_activeRow) _activeRow.removeClass('gridviewrow-highlighted');
     _activeRow = $(this).addClass('gridviewrow-highlighted');
     $(this).each(function() {
          var myID = $(this).find('.gridview-cell-hide').html();
      __doPostBack('MyUpdatePanel', myID);
     });
});

Then I can't seem to get a variation of the above to work for the last column by doing a filter using :last in the selector such as:

$('.gridview-jquerify tr >td:last').filter(function() {
     return $('td)', this).length && !$('table', this).length
})

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery