Add row to grid view

前端 未结 5 2338
庸人自扰
庸人自扰 2021-02-14 08:28

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:56

    I still recommend that you use binding/datasource, but of course you don't have to. The following should do what you want:

            DataGridViewTextBoxColumn columntype = new DataGridViewTextBoxColumn();
            columntype.HeaderText = "Type";
            columntype.Width = 80;
            dataGridView1.Columns.Add(columntype);
    

提交回复
热议问题