我有这段代码:
ProductRanges_Grd.DataSource =
ProductRangesDt.DefaultView.ToTable(true, "PROVIDER_ID", "PROVIDER_NAME");
在绑定我的网格之前,我可以通过PROVIDER_NAME订购吗?我该怎么做呢?
答案 0 :(得分:4)
// Create DataView
DataView view = myDataTable.defaultview;
// Sort by PROVIDER_ID and PROVIDER_NAME column in descending order
view.Sort = "PROVIDER_ID ASC, PROVIDER_NAME ASC";
ProductRanges_Grd.DataSource = view.ToTable();
答案 1 :(得分:0)
myDataTable.DefaultView.Sort = "PROVIDER_NAME ASC";
ProductRanges_Grd.DataSource = myDataTable;
ProductRanges_Grd.DataBind();