【发布时间】:2011-09-27 07:50:51
【问题描述】:
我的网页上有一个 GridView,它的 DataSource 是一个在运行时填充的 DataTable。 GridView 的 AllowSorting 属性为 True。我已经成功地为这个 GridView 实现了手动排序。
但我必须将网页翻译成其他语言,我使用本地资源文件。我在 RowDataBound 事件中更改了 GridView 列的标题文本。从那时起,我无法对 GridView 进行排序。
protected void GVSummaryTable_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.Cells.Count > 0)
{
//Translate header text
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].Text = GetLocalResourceObject("GVSummaryTableName").ToString();
e.Row.Cells[1].Text = GetLocalResourceObject("GVSummaryTableLoginLevel").ToString();
e.Row.Cells[2].Text = GetLocalResourceObject("GVSummaryTableLoginID").ToString();
e.Row.Cells[4].Text = GetLocalResourceObject("GVSummaryTableDate").ToString();
}
}
}
我应该怎么做才能对列进行排序? 任何帮助,将不胜感激。谢谢!
【问题讨论】: