Binding List Item array to repeater
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 i开发者_JAVA百科s the best one to use in this scenario? if I should use ListItem array
, can I bind it to repeater?
You will be fine using an array as a datasource for your DataGrid. From the DataGrid documentation:
The following data sources are valid:
A DataTable
A DataView
A DataSet
A DataViewManager
Any component that implements the IListSource interface
Any component that implements the IList interface
You can see here that array implements IList.
As for getting the name of your role, you can use the Enum.GetName method:
Enum.GetName(TypeOf(RoleEnumType), role_id)
精彩评论