【发布时间】:2018-02-23 22:34:25
【问题描述】:
我有一个简单的收藏
string[] IDs = {"1", "2" , "3", "4"};
Collection<TempOBJ> collection1 = reader.Read()<TempOBJ>(IDs);
在前面几行之后,collection1 包含 4 行和几列:
session | FirstName | LastName | serial | Address | randomID |
---------------------------------------------------------------------------
1 Sam John d3s3 sample 123
2 Sam John d3s3 sample 345
3 Sam John 6g55 asdfggh 678
4 Joe Sammy d7g5 asdfgh 987
然后我将一个网格视图的数据源设置为集合:
GridView1.DataSource = collection1 ;
GridView1.DataBind();
当代码运行时,它会显示所有列。我想要的是特定的列,例如 FirstName、LastName 和 Address。
我该怎么做?
提前致谢
【问题讨论】:
-
什么是阅读器?
-
这只是我使用的一种方法,它是自定义的。它用数据填充集合,我希望显示网格视图中的特定字段。
标签: gridview datasource