当前位置: 动力学知识库 > 问答 > 编程问答 >

Using a GridView (XtraGridView) to display contents of a Hashtable

问题描述:

I have many kinds of objects - the design is such that is not practical to create a subclass for every conceivable combination of attributes. Instead, I have a Hashtable called Attributes that holds the data for each one.

I'm trying to display the contents of Attributes in an XtraGridView/GridView. I'd like each of the key/value pairs to appear in a subview. Like so:

+-----------------------------------------+

| Attributes |

| Key1 | Value1 |

| Key2 | Value2 |

| Key3 | Value3 |

+-----------------------------------------+

Any way to do this?

网友答案:

You just have to specify the Hashtable as the GridView's DataSource.

http://forums.asp.net/t/1173224.aspx

Or you can always transform your data into a Datatable object and then pass THAT to the GridView's DataSource.

分享给朋友:
您可能感兴趣的文章:
随机阅读: