Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8168227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:27:04+00:00 2026-06-06T20:27:04+00:00

I am using the jQuery tablesorter plugin to sort a gridview in an asp.net

  • 0

I am using the jQuery tablesorter plugin to sort a gridview in an asp.net application. I can capture the column index but can’t seem to figure out how to get the column name.

This is what I’m doing:

var currentSort;

        $('#gvTickets').tablesorter({
            // sort on the last column, order asc 
            sortList: [[9, 0]]
        }).bind("sortEnd", function(sorter) {
            currentSort = sorter.target.config.sortList;

        });

Here is the html:

<div>
<table class="stretchalltable" cellspacing="0" rules="all" border="1" id="gvTickets" style="border-collapse:collapse;">
    <thead>
        <tr>
            <th scope="col" class="header" style="cursor: pointer; ">Requester</th><th scope="col" class="header" style="cursor: pointer; ">Subject</th><th scope="col" class="header" style="cursor: pointer; ">Type</th><th scope="col" class="header" style="cursor: pointer; ">Category</th><th scope="col" class="header" style="cursor: pointer; ">Priority</th><th scope="col" class="header" style="cursor: pointer; ">Status</th><th scope="col" class="header" style="cursor: pointer; ">Due</th><th scope="col" class="header" style="cursor: pointer; ">Assigned To</th><th scope="col" class="header" style="cursor: pointer; ">Created</th><th scope="col" class="header headerSortUp" style="cursor: pointer; ">Days</th>
        </tr>
    </thead><tbody>

    <tr>
            <td>JMAULDIN</td><td><a href="ticket2.aspx?action=edit&amp;ticket_id=7827">Van Order Entry Customer Contract Lookup Display</a></td><td>Project</td><td>Portal </td><td>Normal</td><td>On Hold</td><td>&nbsp;</td><td>Nathan Baker - Doozer</td><td>27-DEC-2011</td><td>133</td>
        </tr><tr style="background-color:#E6E6E6;">
            <td>RCRITTENDEN</td><td><a href="ticket2.aspx?action=edit&amp;ticket_id=8190">Cap changes</a></td><td>Project</td><td>Portal </td><td>Normal</td><td>On Hold</td><td>&nbsp;</td><td>Nathan Baker - Doozer</td><td>02-FEB-2012</td><td>106</td>
        </tr><tr style="background-color:#E6E6E6;">
            <td>JMAULDIN</td><td><a href="ticket2.aspx?action=edit&amp;ticket_id=8796">Online SRN  -- Add email SRN like print SRN</a></td><td>Project</td><td>Portal </td><td>Normal</td><td>New</td><td>&nbsp;</td><td>Nathan Baker - Doozer</td><td>15-MAR-2012</td><td>76</td>
        </tr><tr>
            <td>JMAULDIN</td><td><a href="ticket2.aspx?action=edit&amp;ticket_id=9058">SES AST field not saving correctly.</a></td><td>Project</td><td>Portal </td><td>Normal</td><td>On Hold</td><td>&nbsp;</td><td>Nathan Baker - Doozer</td><td>20-MAR-2012</td><td>73</td>
        </tr><tr>
            <td>RAVRIETT</td><td><a href="ticket2.aspx?action=edit&amp;ticket_id=9470">Copy Project Plan (ignore deleted items)</a></td><td>Support Task</td><td>Loaned Item </td><td>Normal</td><td>New</td><td>&nbsp;</td><td>Nathan Baker - Doozer</td><td>24-APR-2012</td><td>48</td>
        </tr><tr>
            <td>TCACCAM</td><td><a href="ticket2.aspx?action=edit&amp;ticket_id=9670">WEB: Contracts Administration</a></td><td>Support Task</td><td>Portal </td><td>High</td><td>New</td><td>14-MAY-2012</td><td>Nathan Baker - Doozer</td><td>14-MAY-2012</td><td>34</td>
        </tr><tr style="background-color:#E6E6E6;">
            <td>DOOZER1</td><td><a href="ticket2.aspx?action=edit&amp;ticket_id=10041">nb test</a></td><td>Project</td><td>Portal </td><td>Normal</td><td>New</td><td>13-JUN-2012</td><td>Nathan Baker - Doozer</td><td>13-JUN-2012</td><td>12</td>
        </tr></tbody>
</table>
</div>

Update

Thank you to fudgey for your replies. I can’t seem to get this to work no matter what I try. Basically what I need to do is in the jquery tablesorter, I need to have the sortList value be a variable. It would need to look like this:

var currentSort;

    $('#gvTickets').tablesorter({
        // sort on the last column, order asc 
        sortList: currentSort
    }).bind("sortEnd", function(sorter) {
        currentSort = sorter.target.config.sortList;

    });

I need to store the currentSort in Session and retrieve it via an ajax call then sort the grid in the same way it was last viewed. If the user hits the page, sorts the grid, leaves the page and then returns I need it to be sorted in the same way as the last time they were on the page as long as it’s within the scope of the session state.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:27:05+00:00Added an answer on June 6, 2026 at 8:27 pm

    Use the index to find the text from the header – it might even be easier to use the saved headerList like this (demo):

    $('#gvTickets')
        .tablesorter({
            // sort on the last column, order asc 
            sortList: [[9, 0]]
        })
        .bind("sortEnd", function(event) {
            var table = event.target,
                currentSort = table.config.sortList,
                // target the first sorted column
                columnNum = currentSort[0][0],
                columnName = $(table.config.headerList[columnNum]).text();
    
            console.log(columnName);
    
        });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Tablesorter Jquery plugin to sort a table, but the images background
am using jquery tablesorter plugin and in my country column i got special characters
I'm using the jQuery tablesorter plugin to sort a table, which assigns .click() handlers
I'm using jQuery along with the tablesorter plugin to sort a table. Everything is
I'm using the tablesorter( http://tablesorter.com ) jquery plugin to sort table data... Does anyone
I'm using the jQuery tablesorter plugin and I have a column that contains name
I'm using the JQuery tablesorter plugin. The table has a column that shows dates
I am using the jquery tablesorter plugin to sort a table. On of my
I'm trying to use the tablersorter jQuery plugin (www.tablesorter.com), but I can't get it
I am using the TableSorter plugin in jquery. However one of the column in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.