【发布时间】:2014-04-24 17:15:48
【问题描述】:
我在 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
【问题讨论】:
标签: asp.net ajaxcontroltoolkit tablesorter rowdatabound