GridView已绑定数据,为IList<>,现在要转为Datatable,如何转换?是为了点列标题进行排序,有没有别的简单的办法进行排序?谢谢!

解决方案 »

  1.   

    3.5有个扩展方法asDatatable 直接转换
      

  2.   

    3.5没用过 
    2.0下,我都是老老实实的逐行取出,生成datatable
      

  3.   

    是在2。0下,Gridview.datasource = IList<>,转换为Datatable怎么转,网上找的代码运行有问题。
      

  4.   

    GridView他的数据源   转换为datatable
      

  5.   

    排序不需要轉換成Datatable
    if (!string.IsNullOrEmpty(SortColumnExpression))
            {            sb_RecordData.Append(" order by ").Append(SortColumnExpression);
            }
            else
            {
                sb_RecordData.Append(" order by").Append(" A.CREATEDATE Desc");
            }