62,074
社区成员
发帖
与我相关
我的任务
分享
Dim intNum As Integer = 0 '用来计算数据绑定到第几行
Dim identity As Integer = 0 '用来计算前面添加了多少个空行
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
intNum = intNum + 1
If intNum Mod 2 = 0 And intNum <> 10 Then 'mod 2这里用的是2你可以改为5 ;10为没页显示的行数
Dim grv As GridViewRow = New GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal)
Dim cell As TableCell = New TableCell
cell.Text = " "
grv.Cells.Add(cell)
GridView1.Controls(0).Controls.AddAt(intNum + identity + 1, grv)
identity += 1
End If
End If
End Sub