Adding multiple rows Rows in the Grid View
Row 1
If (e.Row.RowType = DataControlRowType.Header) Then
Dim oGridView As GridView = DirectCast(sender, GridView)
'Add Query
Dim oGridViewRow As New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert)
Dim oTableCell As New TableCell()
oTableCell.ColumnSpan = 3
oTableCell.Text = "Query : " & Request.QueryString("Query")
oGridViewRow.BorderColor = Drawing.Color.Black
oGridViewRow.BackColor = Drawing.Color.Gray
oGridViewRow.ForeColor = Drawing.Color.Black
oGridViewRow.HorizontalAlign = HorizontalAlign.Left
oGridViewRow.Cells.Add(oTableCell)
oGridView.Controls(0).Controls.AddAt(0, oGridViewRow)
Row 2
'Add Value
oGridViewRow = New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert)
oTableCell = New TableCell()
oTableCell.Text = "Value : " & Request.QueryString("Value")
oTableCell.ColumnSpan = 3
oGridViewRow.BorderColor = Drawing.Color.Black
oGridViewRow.BackColor = Drawing.Color.Gray
oGridViewRow.ForeColor = Drawing.Color.Black
oGridViewRow.HorizontalAlign = HorizontalAlign.Left
oGridViewRow.Cells.Add(oTableCell)
oGridView.Controls(0).Controls.AddAt(1, oGridViewRow)
Row 3
'Add Track List
oGridViewRow = New GridViewRow(0, 1, DataControlRowType.Header, DataControlRowState.Insert)
oTableCell = New TableCell()
oTableCell.Text = "Track List : " & Request.QueryString("TrackList")
oTableCell.ColumnSpan = 3
oGridViewRow.BorderColor = Drawing.Color.Black
oGridViewRow.BackColor = Drawing.Color.Gray
oGridViewRow.ForeColor = Drawing.Color.Black
oGridViewRow.BorderColor = Drawing.Color.Black
oGridViewRow.HorizontalAlign = HorizontalAlign.Left
oGridViewRow.Cells.Add(oTableCell)
oGridView.Controls(0).Controls.AddAt(2, oGridViewRow)
End If
If (e.Row.RowType = DataControlRowType.Header) Then
Dim oGridView As GridView = DirectCast(sender, GridView)
'Add Query
Dim oGridViewRow As New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert)
Dim oTableCell As New TableCell()
oTableCell.ColumnSpan = 3
oTableCell.Text = "Query : " & Request.QueryString("Query")
oGridViewRow.BorderColor = Drawing.Color.Black
oGridViewRow.BackColor = Drawing.Color.Gray
oGridViewRow.ForeColor = Drawing.Color.Black
oGridViewRow.HorizontalAlign = HorizontalAlign.Left
oGridViewRow.Cells.Add(oTableCell)
oGridView.Controls(0).Controls.AddAt(0, oGridViewRow)
Row 2
'Add Value
oGridViewRow = New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert)
oTableCell = New TableCell()
oTableCell.Text = "Value : " & Request.QueryString("Value")
oTableCell.ColumnSpan = 3
oGridViewRow.BorderColor = Drawing.Color.Black
oGridViewRow.BackColor = Drawing.Color.Gray
oGridViewRow.ForeColor = Drawing.Color.Black
oGridViewRow.HorizontalAlign = HorizontalAlign.Left
oGridViewRow.Cells.Add(oTableCell)
oGridView.Controls(0).Controls.AddAt(1, oGridViewRow)
Row 3
'Add Track List
oGridViewRow = New GridViewRow(0, 1, DataControlRowType.Header, DataControlRowState.Insert)
oTableCell = New TableCell()
oTableCell.Text = "Track List : " & Request.QueryString("TrackList")
oTableCell.ColumnSpan = 3
oGridViewRow.BorderColor = Drawing.Color.Black
oGridViewRow.BackColor = Drawing.Color.Gray
oGridViewRow.ForeColor = Drawing.Color.Black
oGridViewRow.BorderColor = Drawing.Color.Black
oGridViewRow.HorizontalAlign = HorizontalAlign.Left
oGridViewRow.Cells.Add(oTableCell)
oGridView.Controls(0).Controls.AddAt(2, oGridViewRow)
End If
No comments:
Post a Comment