Add row to grid view

前端 未结 5 2015
予麋鹿
予麋鹿 2021-02-14 07:57

Is it possible to programmatically add a row to a GridView in C# ASP?

If yes, how ?

I want to add static data directly from the code, not from an array nor an da

5条回答
  •  佛祖请我去吃肉
    2021-02-14 08:55

    dataGridView1.Columns[0].Name = "column1";
    dataGridView1.Columns[1].Name = "column2";
    
    string[] row1 = new string[] { "column1 value", "column2 value" };
    dataGridView1.Rows.Add(row1);
    

提交回复
热议问题