How to get values from GridView in JavaScript

Viewed 367

I have an ASP.NET GridView (called "ActionsGrid") with several BoundFields as columns. In my JavaScript, I want to look at each selected row (with class name "highlighted") and extract the cell values from particular columns (1, 3, and 4).

Here's my script:

var params = [];

$('#ActionsGrid tr').each(function () {
    if (this.className === 'highlighted') {
        var record_pk = this.children("td:nth-child(1)");
        var obj_name = this.children("td:nth-child(3)");
        var obj_pk = this.children("td:nth-child(4)");
        params.push(record_pk + "," + obj_name + "," + obj_pk + "¬");
    }
});

My variables just return 'undefined'. Am I close?

2 Answers
Related