English 中文(简体)
使用 GridView(XtraGridView)来显示 Hashtable 的内容。
原标题:Using a GridView (XtraGridView) to display contents of a Hashtable

我有许多类型的对象-设计意味着不切实际为每个可能的属性组合创建子类。相反,我有一个名为属性的Hashtable,它保存每个对象的数据。

我正在尝试在XtraGridView/GridView中显示Attributes的内容。我希望每个键/值对都出现在子视图中。就像这样:

+-----------------------------------------+
| Attributes                              |
|     Key1            |  Value1           |
|     Key2            |  Value2           |
|     Key3            |  Value3           |
+-----------------------------------------+

有什么办法可以做到这个?

问题回答

你只需要将Hashtable指定为GridView的数据源。

http://forums.asp.net/t/1173224.aspx (请点击链接)

或者您可以将数据转换为Datatable对象,然后将其作为GridView的数据源传递。





相关问题
Anagram Hash Function

I know something like this has been asked before, but the answer was sort of side tracked. I want to develop a hash function which will take a word and spit out an address of an array. So, for ...

Frequently Used metadata Hashmap

Are there any implementations of a static size hashtable that limits the entries to either the most recently or most frequently used metadata? I would prefer not to keep track of this information ...

热门标签