Я новичок в ASP.NET.Я хочу добавить столбец к GridView
динамически на основе ответа API
id User secretcode
1 u1 {response from the API based on the Id value}
2 u1 {response from the API based on the Id value}
3 u1 {response from the API based on the Id value}
4 u1 {response from the API based on the Id value}
5 u1 {response from the API based on the Id value}
id
и User
уже есть в моей таблице базы данных (пользователи), поэтому для каждой возвращаемой строкиЯ хочу вызвать API, чтобы заполнить 3-й столбец, т.е. secretcode
.По сути, меня смущает, где использовать цикл ForEach.
Это грубый код, над которым я работаю:
DataTable table = new DataTable();
DataColumn col3 = new DataColumn("Secretcode");
col3.DataType = System.Type.GetType("System.Int");
table.Columns.Add(col3);
row[col3] = {response data from API}
gvTest.DataSource = table;
gvTest.DataBind();