回复 1楼wugrid的帖子
谢谢反馈,你可以使用C1FlexGrid的DataMap功能。
代码参考:
- // load data into some tables
- var dtProducts = GetDataTable("Products");
- var dtCategories = GetDataTable("Categories");
- var dtSuppliers = GetDataTable("Suppliers");
- // create two data maps
- var mapCat = new Dictionary<int ,="" string="">();
- foreach (DataRow row in dtCategories.Rows)
- {
- var key = (int)row["CategoryID"];
- var val = (string)row["CategoryName"];
- mapCat[key] = val;
- }
- var mapSup = new Dictionary<int ,="" string="">();
- foreach (DataRow row in dtSuppliers.Rows)
- {
- var key = (int)row["SupplierID"];
- var val = (string)row["CompanyName"];
- mapSup[key] = val;
- }
- // bind grid
- _flex.DataSource = dtProducts;
- // add data maps
- _flex.Cols["CategoryID"].DataMap = mapCat;
- _flex.Cols["SupplierID"].DataMap = mapSup;</int></int>
复制代码
参考博客:
http://blog.gcpowertools.com.cn/ ... rid_sortbyname.aspx |