Add row to grid view

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

    DataTable dt = new DataTable();
    DataRow dr = dt.NewRow();
    dr["Column1"] = string.Empty;
    dt.Rows.Add(dr);
    

    You can then bind your GridView to the DataTable...

    gv.DataSource = dt;
    gv.DataBind();
    

提交回复
热议问题