ASP.NET Sort gridview using tableSort

365
July 10, 2017, at 7:51 PM

I have an ASP.NET web application where I pull some data from a database and bind it to a gridview upon a users dropdownlist selection. The gridview contains (among others), a checkbox column. I want to implement gridview sorting but the problem with using AllowSorting and OnSorting is that it postbacks and I lose the checkbox selections.

So I decided to look into client side sorting and I jquery tableSort. I'm trying to implement it but it doesn't sort anything.

I added in the header prerequisites that point to the jquery scripts

Now I need to add

$(document).ready(function() 
    { 
        $("#myTable").tablesorter(); 
    } 
); 

I have done that (replacing myTable with my gridview id) and it's not sorting anything. Could it be because I'm not binding the data in PageLoad ? I'm doing it in another function because I'm waiting for a user selection.

Then I found out it needs to render the THEAD and TBODY. So I added the following just after binding the data to the gridview:

onlineSearchGridView.UseAccessibleHeader = true;//I read that this is true by default and don't really need it onlineSearchGridView.HeaderRow.TableSection = TableRowSection.TableHeader;

Having said all this, what could I do to make the gridview sort ? I don't understand how does the tablesort know when I click on a header column ? There is no link or button or anything. How is the event being detected? My guess is that it's not sorting because the function where I specify tablesorter is not being reached, or it's being called too early before there is any header in the gridview ?

Rent Charter Buses Company
READ ALSO
jquery event are not works on ajax loaded content(html) [duplicate]

jquery event are not works on ajax loaded content(html) [duplicate]

This question already has an answer here:

259
Scroll to the element id that is suppose to be loaded via Ajax (Infinite Scroll)

Scroll to the element id that is suppose to be loaded via Ajax (Infinite Scroll)

So, I have two pages, notifications and topicTopic page has comments, every comment has an unique id

230
PHP AJAX Login (Internal Server Error)

PHP AJAX Login (Internal Server Error)

I am trying to create a login page using JQuery AJAX calls to a PHP page, however, i am experiencing difficulties, I keep getting (Internal Server Error) from my console but I can not seem to see the issueCan someone please help look at my code

335
Creating a plottable graph

Creating a plottable graph

I am building a javascript (Backbone and Marionette) appIn this app I need to plot a graph with an X and a Y axle

245