简体   繁体   English

在Gridview中间添加新行

[英]Add New Row at Middle of Gridview

i want to add new row at middle of the gridview. 我想在gridview的中间添加新行。 How to achieve this. 如何实现这一目标。

The Gridview bind by DataTable. Gridview由DataTable绑定。 In DataBound Event I want to add new row in particular row, using row index 在DataBound Event中,我想使用行索引在特定行中添加新行

You can insert a row at specific position use the API of your binding source. 您可以使用绑定源的API在特定位置插入行。 For example if the grid is bound to a DataTable use the following code: 例如,如果网格绑定到DataTable,请使用以下代码:

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

DataGridView.Rows Property DataGridView.Rows属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM