【问题标题】:How to sort Gridview items如何对 Gridview 项目进行排序
【发布时间】:2011-07-01 17:58:47
【问题描述】:

我在 c# asp.net 中有一个动态创建的gridview,我需要在加载页面时对其进行排序。如何才能做到这一点?我正在使用gridview1.DataBind()进行绑定。

【问题讨论】:

  • 如果您需要真正的帮助,请详细说明。
  • 使用DataView -> 对其进行排序,然后将该数据视图绑定到您的网格。

标签: c# asp.net visual-studio sorting gridview


【解决方案1】:

试试这个

DataTable table = GetTable();
table.DefaultView.Sort = "SortCondition";

//
// Display all records in the view.
//
DataView view = table.DefaultView;

现在绑定网格

 GridView1.DataSource=view;
 GirdView1.DataBind();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-08
    • 2011-07-18
    • 1970-01-01
    • 2014-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多