Я новичок в ASP.NET. Я хочу добавить столбец GridView
динамически на основе отклике APIЗаполните данные столбца 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();
thnx, который помог –