我在 ASP.NET 上使用带有 Gridview 的 Tablesorter 2.0 插件。我使用此代码来解决THEAD
问题:
if (GridView1.Rows.Count > 0)
{
GridView1.UseAccessibleHeader = true;
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
}
对行进行排序时一切正常,但是当我使用此代码postback
单击每一行时,问题就开始了
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 一直运行良好,我可以对列进行排序,但是当我单击 gridview 上的一行进行回发时,因为
<tr onclick="javascript:__doPostBack('ctl00$MainContent$GridView1','Select$1')">
我之前的排序行返回到它们的原始位置,就像第一次加载一样,并且不保留我所做的排序. 以防万一,我也在使用UpdatePanel