DataGrid 绑定 ArrayList 的问题
我自己写了一个类,有 a , b ,c 等域。
我的 ArrayList 装有 这个类的许多个对象,
然后我用 DataGrid 绑定这个 ArrayList,
我想让 DataGrid 显示出 有 a , b ,c 等列 的表,
请问具体怎么设置?
或者 DataGrid 没有这个功能?
希望大家不吝赐教。
问题点数:20、回复次数:5Top
1 楼karma(无为MS MVP)回复于 2002-03-27 12:13:23 得分 6
sure, use ItemTemplate, and evaluate the data this way:
<%# ((SomeClass)Container.DataItem).a %>
<%# ((SomeClass)Container.DataItem).b %>
......
Top
2 楼xiaow(小为)回复于 2002-03-27 14:50:27 得分 0
你这样写,当然可以显示,可是完全没有用到 DataGrid 呀?
而那正是我需要的...Top
3 楼ttt2(孩子她爸)回复于 2002-03-27 17:19:31 得分 7
dim a as arraylist
a=new arraylist()
a.add("a")
a.add("c")
datagrid1.datasource=a
datagrid1.databind()Top
4 楼xiaow(小为)回复于 2002-03-27 17:43:15 得分 0
这是一维的表格,microsoft给的也是这种例子,难道 arrayList 作为数据源就只能达到这种简单的效果吗?Top
5 楼karma(无为MS MVP)回复于 2002-03-27 23:34:03 得分 7
in the ItemTemplate, Container.DataItem is your individual element, you need to cast it into the right type and use the object to do whatever you wantTop
相关问题
- 如果将ArrayList绑定到DataGrid (winform)
- DataGrid 绑定的是ArrayList ,晕了
- DataGrid控件如何绑定到ArrayList?
- 请教ArrayList绑定DataGrid的问题
- DataGrid绑定了ArrayList,如何将DataGrid列名更改成中文
- DataGrid绑定了ArrayList,如何将DataGrid列名更改成中文
- ArrayList绑定DataGrid的问题。在线急盼!!
- 关于将ArrayList绑定到DataGrid上的一个小问题
- 高分求助:arraylist绑定DATAGRID,添加数据,DATAGRID不能刷新显示。
- ArrayList绑定到DropDownLis




