gridview - 如何动态更改 gridview 模板列顺序?

标签 gridview templates dynamic

如何动态更改 gridview 模板列顺序?

最佳答案

  • 迭代 通通栏目 网格 View 对象和 店铺 他们在 收藏 .
    List<DataControlField> columns = new List<DataControlField>();
    foreach (DataControlField column in gv.Columns)
    {
        columns.Add(column);
    }
    
  • 重新排列 列对象 如您所愿。
    //Rearrange columns' collection..
    
  • 清除所有列 GridView 对象和 从集合中添加列 网格 View 目的。
     gv.Columns.Clear();
     foreach (DataControlField column in columns)
     {
         gv.Columns.Add(column);
     }
    
  • 关于gridview - 如何动态更改 gridview 模板列顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2011574/

    相关文章:

    mysql - 如何从mysql动态表中获取两列

    c# - 将 GridView 和一些文本下载到 ASP.NET 网站的 Excel 中

    c# - 将 ASP.NET GridView 控件绑定(bind)到字符串数组

    c++ - C++ 中一个模板函数中使用的类的不常见函数

    jquery - 在 jQuery Mobile 日期框中动态设置最大日期

    javascript - 使用 Scrapy-splash 导航动态页面

    c# - 在客户端添加 Gridview 新行

    c# - gridview ItemTemplate 中的 if 语句

    c++ - 将指针转换为 int/将指针存储为类型 T

    c++ - 循环模板类型