0

I'm using a Tablesorter 2.0 plugin with Gridview on ASP.NET. I used this code to fix the THEAD problem :

if (GridView1.Rows.Count > 0)
   {
      GridView1.UseAccessibleHeader = true;
      GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
      GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
   }

Everything worked fine with sorting rows, but the problem begins when I used this code to do postback when clicking on each row

Private Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            e.Row.Attributes("onclick") = Page.ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" & e.Row.RowIndex)
        End If
End Sub

Tablesorter keeps working well, I can sort columns, however when I click on a row on my gridview to do a postback as <tr onclick="javascript:__doPostBack('ctl00$MainContent$GridView1','Select$1')"> my previous sorted rows return to their original positions as if loaded the first time, and don't preserve the sort I did. Just in case, I'm also using a UpdatePanel

Walter Colchado
  • 337
  • 1
  • 6
  • 16

1 Answers1

0

I have a fork of tablesorter which has a saveSort widget which saves the current sort to local storage, with a cookie fallback. Sadly the widget won't work on the original version of tablesorter.

Mottie
  • 84,355
  • 30
  • 126
  • 241