RE: Inserting subtotal rows into a datatable
From: Steven Cheng[MSFT] (v-schang_at_online.microsoft.com)
Date: 11/08/04
- Next message: Jéjé: "ways to improve compilation?"
- Previous message: Vishal: "Re: Date Conversion probs"
- In reply to: GaryB: "Inserting subtotal rows into a datatable"
- Next in thread: GaryB: "Re: Inserting subtotal rows into a datatable"
- Reply: GaryB: "Re: Inserting subtotal rows into a datatable"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 08 Nov 2004 03:32:41 GMT
Hi Gary,
>From your description, you're using the InsertAt method of
DataRowCollection to insert new rows into a manually generated DataTable
and then bind it onto a webform datagrid. However, you found the new added
rows always display at the bottom of the datagrid, yes?
As John has mentioned, the means how to bind the datatable to the grid may
also change the display order since Only the raw "Rows" collection of the
DataTable will reflect the correct rows order in the collection. If we use
some other methods such as Select() or GetChildRows to retreive datarows
from DataTable, the retuned rows may not represent the actual order in the
Rows collection. So would you provide some info on how you bind the
DataTable onto the grid? Also, I suggest you manually use
for(i=0;i<Table.Rows.Count; i++)
...
to printout all the rows in the DataTable after you inserting new rows to
verify whether the actual order in the Rows collection is correct.
In addition, from the code you provided, seems you will insert new rows
in the following loop
For i = 0 To dsDisplay.Tables(0).Rows.Count - 1
Dim row As DataRow = dsDisplay.Tables(0).Rows(i)
That may cause the Table's Rows Collection be modified during the for loop
and thus the "i" iterate index may point to the incorrect record. Not sure
whether this will also be the potential cause of this issue.
Hope helps. If you have any other findings , please also feel free to post
here. thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
- Next message: Jéjé: "ways to improve compilation?"
- Previous message: Vishal: "Re: Date Conversion probs"
- In reply to: GaryB: "Inserting subtotal rows into a datatable"
- Next in thread: GaryB: "Re: Inserting subtotal rows into a datatable"
- Reply: GaryB: "Re: Inserting subtotal rows into a datatable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|