简体   繁体   English

ASP.NET GridView RowCreated动态添加一行

[英]ASP.NET GridView RowCreated add a row dynamically

I have a dynamically bound GridView control and I want to add a row after the bound one, but I can't imagine the way to do it. 我有一个动态绑定的GridView控件,我想在绑定的控件之后添加一行,但是我无法想象这样做的方法。

Inside the GridView.RowCreated I have this code: 在GridView.RowCreated内部,我有以下代码:

                Dim gvr As New GridViewRow(0, -1, DataControlRowType.DataRow, DataControlRowState.Normal)
                Dim thc As New TableCell
                thc.Text = "Text"

                gvr.Cells.Add(thc)

                GridView1.Controls(0).Controls.Add(gvr)

It is working well, butit is inserting a row before the databound row. 它运行良好,但是它在数据绑定行之前插入了一行。 Please, is there any way to insert the dynamic row after the databound? 请问有什么方法可以在数据绑定之后插入动态行?

It seems that the first parameter of the constructor is the row index. 似乎构造函数的第一个参数是行索引。

Dim i as Integer = gvr.Row.Count
Dim gvr As New GridViewRow(i, -1, DataControlRowType.DataRow, DataControlRowState.Normal)

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

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