Reputation: 177
I must bind a gridview to a method which returns list<>
, there are few multi select lookups in the list, for this I have a method which returns dictionary<int, string>
.
In the list I have the multi select item values as {1, xyz}, {2, abc}
So I must display in the grid as xyz, abc.
For this I have written a method FormatString
which is called in gridview binding.. i.e aspx page
<%# FormatString(?????????) %>
I must pass list<>
in the ???? to retreive the data..
Please suggest me some solutions..
Upvotes: 0
Views: 629
Reputation: 14460
You can try this way
Get the values to a different list from your dictionary items
var items = yourDictionary.Values.SelectMany(x => x).ToList();
Then you can simply bind the list to gridview
Upvotes: 0
Reputation: 3662
'<%# FormatString(Container.DataItem as YourListType) %>'
public String FormatString(YourListType listObj )
{
//do what you want.
}
Upvotes: 1