S
sam
Hello Group,
I am working on inserting Rows in the datagrid as follows:
Private Function addHeaderLines(ByVal ds As DataSet) As DataSet
Dim dr, drBlank As DataRow
Dim count, repeatCount, upperBound As Integer
repeatCount = iMaxLines
upperBound = ds.Tables(1).Rows.Count
While count <= upperBound
If repeatCount = 1 Then
drBlank = ds.Tables(1).NewRow
drBlank(1) = "-1"
ds.Tables(1).Rows.InsertAt(drBlank, count + 1)
count += 1
upperBound += 1
repeatCount = iMaxLines
Else
repeatCount -= 1
End If
count += 1
End While
Return ds
End Function
In the itemDatabound event, I assign the rows with the required data
to be inserted as below:
If CType(CType(e.Item.DataItem, DataRowView).Row.Item(1), String) =
"-1" Then
e.Item.Cells(0).ColumnSpan = 14
e.Item.Cells(0).Text = sbHeader.ToString
e.Item.BackColor = System.Drawing.Color.White
End If
sbHeader has a table which needs to be inserted in the empty row.
When I bind the table(1) of dataset ds to a datagrid, the rows seem to
be appended at the end of the datagrid inspite of not allowing the
sort. Not sure why is that happening. Any help with the same is
appreciated!!
Thanks,
Sam.
I am working on inserting Rows in the datagrid as follows:
Private Function addHeaderLines(ByVal ds As DataSet) As DataSet
Dim dr, drBlank As DataRow
Dim count, repeatCount, upperBound As Integer
repeatCount = iMaxLines
upperBound = ds.Tables(1).Rows.Count
While count <= upperBound
If repeatCount = 1 Then
drBlank = ds.Tables(1).NewRow
drBlank(1) = "-1"
ds.Tables(1).Rows.InsertAt(drBlank, count + 1)
count += 1
upperBound += 1
repeatCount = iMaxLines
Else
repeatCount -= 1
End If
count += 1
End While
Return ds
End Function
In the itemDatabound event, I assign the rows with the required data
to be inserted as below:
If CType(CType(e.Item.DataItem, DataRowView).Row.Item(1), String) =
"-1" Then
e.Item.Cells(0).ColumnSpan = 14
e.Item.Cells(0).Text = sbHeader.ToString
e.Item.BackColor = System.Drawing.Color.White
End If
sbHeader has a table which needs to be inserted in the empty row.
When I bind the table(1) of dataset ds to a datagrid, the rows seem to
be appended at the end of the datagrid inspite of not allowing the
sort. Not sure why is that happening. Any help with the same is
appreciated!!
Thanks,
Sam.