Nithesh Narayanan
Nithesh Narayanan

Reputation: 11755

How can i Get Grid view values using jquery

HI

I am using asp grid view... How can i get particular values in the grid view using jquery... Foe eg:_ i want to get all the values of 5th column in the grid view. Then how can I do this using Jquery?

Thanks in advance.....

Upvotes: 0

Views: 2570

Answers (1)

jwheron
jwheron

Reputation: 2562

Since you didn't post any markup, you'll have to adapt this to your Grid, but that shouldn't be a big deal.

Given a GridView like the following:

<asp:GridView ID="thisGrid" ...>
    <Columns>
        <asp:BoundField ID="columnOne" ... > <!-- Column type irrelevant -->
        <asp:BoundField ID="columnTwo" ... >
        <asp:BoundField ID="columnThree" ... >
        <asp:BoundField ID="columnFour" ... >
        <asp:BoundField ID="columnFive" ... >
        <!-- number of columns irrelevant as well -->
    </Columns

Your selector looks something like: $("table#ctl100_thisGrid tbody td:nth-child(5)").text(). My table ID may be a little off -- I use a Master Page on my project, so its ID ends up in the middle of my GridView IDs -- but that will get you only the fifth column of every row in your table body.

Upvotes: 1

Related Questions