Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim eRowDataItem As Data.DataRowView = e.Row.DataItem
Dim eRowDataItemRow As Data.DataRow = eRowDataItem.Row
Dim Comments As String = ""
If eRowDataItemRow.Item("Comments") IsNot DBNull.Value Then
Comments = eRowDataItemRow.Item("Comments")
End If
If Comments <> "" Then
Dim eRowParentTable As Table = e.Row.Parent
Dim NewGridViewRow As New GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal)
Dim NewTableCell As New TableCell
NewTableCell.ColumnSpan = 6
NewTableCell.Width = Unit.Percentage(100)
NewTableCell.Text = Comments
NewGridViewRow.Cells.Add(NewTableCell)
Dim NewSpan As New HtmlGenericControl("span")
NewSpan.InnerText = Comments
NewTableCell.Controls.Add(NewSpan)
eRowParentTable.Rows.AddAt(eRowParentTable.Rows.Count, NewGridViewRow)
End If
End If
End Sub
Tips and tricks for .NET using ASP and VB code.
Insert rows in a GridView
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment