I would like to display part of a Sharepoint List in a Visual Web Part. I read about SPGridView but how can i make the number of columns dynamic (i don't know how long my list will be beforehand), and how can I create columns in columns ?
1 Answers
0
votes
Using c# Api, you can find out what are the columns :
Example using :
SPList list = web.List["My list"];
list.Fields...
And create the SPGridView Column dynamically by c# Code as well
GridView listTypeBot = new GridView();
// Create my column
BoundField bf = new BoundField();
bf.HeaderText = "Types of bot available";
// Add my column to my gridview
listTypeBot.Columns.Add(bf);
Code provided as example (not working code)