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 ?
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.