0

Olá eveyone,

I have a datasource which returns a single row like this:

Group        Roles
1            4,3,2

now, I need to translate that into a repeater like this:

GroupName

Admin        (know more)
Doctor       (know more)
Support      (know more)

when user clicks on know more then imma show them the right page. all is okay, only, since my DataSet is a single row, I Was wondering how to do this. I have an enum with those roles so translating numbers to roles is not a problem.

I was thinking split that string 4,3,2 into array and bind it to repeater. but I need the group name as well.

so I want something like ListItem(GroupName, Role) for each of the roles. so list item is great. or keyvalue pair array.

I am confused which is the best one to use in this scenario? if I should use ListItem array, can I bind it to repeater?

4

1 回答 1

0

您可以使用数组作为 DataGrid 的数据源。从DataGrid 文档

以下数据源有效:

数据表

数据视图

一个数据集

数据视图管理器

任何实现 IListSource 接口的组件

任何实现 IList 接口的组件

您可以在此处看到该数组实现了 IList。

至于获取角色的名称,可以使用Enum.GetName方法:

Enum.GetName(TypeOf(RoleEnumType), role_id)
于 2011-02-08T12:36:02.407 回答