DataView dv = DataSet1.Tables["tableName"].DefaultView;
dv.Sort = "Col1 DESC, Col2, Col3";
DataGrid1.DataSource = dv;
DataGrid1.DataBind();
dv.Sort = "Col1 DESC, Col2, Col3";
DataGrid1.DataSource = dv;
DataGrid1.DataBind();
学名,姓名,状态
1,张三,在线这个“状态”不是从数据库里生成的,而是根据当时某个条件生成的,所以不能用这个方法,
因为不知道COL了,现在唯一知道就是DATAGRID列标题名称了,不知如何办?
ds.sort = "bh,name,password,tel,address";
然后再把数据窗口绑定到这个ds中来就可以了.
页面加载的时候会自动根据你设定的排序字段来排序