Add row to grid view

前端 未结 5 1985
予麋鹿
予麋鹿 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:53

    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);
    

提交回复
热议问题