简体   繁体   中英

Add New Row at Middle of Gridview

i want to add new row at middle of the gridview. How to achieve this.

The Gridview bind by DataTable. In DataBound Event I want to add new row in particular row, using row index

You can insert a row at specific position use the API of your binding source. For example if the grid is bound to a DataTable use the following code:

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

DataGridView.Rows Property

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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