I have a variable defined as follows:
Dim iRows As List(Of String())
I’ve also been converting that to a list of lists just to make it easier to work with.
Dim iRows As List(Of IList(Of String))
I would like to bind that list to a GridView using the contents of the nested array/list to dynamically define the columns. I don’t know ahead of time how many columns there will be, but I do know that they are all the same throughout the list.
I’m just not real sure how to go about it. Thoughts?
Seems to me, that without knowing how your datasource looks like / how many columns there will be, there is no way to put each column into a different gridview column.
That means, fixed markup is not possible => You need to set the AutoGenerateColumns property to true.
You can set the HeaderText of each column by accessing the HeaderCollecion of the GridView, if you want to use a different
Another solution you might be interested in, would be not to use the GridView at all, if you are only interested in displaying data (meaning no edit or delete buttons) You could render your data into a html table with columns and rows, by using Reflection, like aleafonso suggested.