【问题标题】:Add New Row at Middle of Gridview在 Gridview 中间添加新行
【发布时间】:2014-02-01 06:11:50
【问题描述】:

我想在网格视图的中间添加新行。如何实现这一点。

由 DataTable 绑定的 Gridview。在 DataBound 事件中,我想使用行索引在特定行中添加新行

【问题讨论】:

    标签: c# asp.net gridview


    【解决方案1】:

    您可以使用绑定源的 API 在特定位置插入一行。例如,如果网格绑定到 DataTable,请使用以下代码:

    DataRow row = table.NewRow();
    table.Rows.InsertAt(row, 5);
    

    DataGridView.Rows Property

    【讨论】:

      猜你喜欢
      • 2017-11-08
      • 2011-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-27
      • 1970-01-01
      相关资源
      最近更新 更多