DataTable dt = new DataTable();
        dt.Columns.Add("Column_1", typeof(int));
        dt.Columns.Add("Column_2", typeof(string));
        dt.Columns.Add("Column_3", typeof(string));

        dt.Rows.Add(1, "二", "C");
        dt.Rows.Add(2, "三", "A");
        dt.Rows.Add(3, "一", "B");

        // 反向排序
        dt.DefaultView.Sort = "Column_1 DESC"; //正向排序把 DESC 拿掉即可

        GridView1.DataSource = dt;
        GridView1.DataBind();


arrow
arrow

    Roger 發表在 痞客邦 留言(0) 人氣()