After inserting a row in my databound grid I am trying to move the current cell back one line into the current cell. Although I am inserting a blank record into the data, after the current cell is moved, the data from the previous currentcell shows in my new currentcell. However, if I then move off the new currentcell and then back it shows up blank like it should. The code I''m using follows. How can I prevent this from happening?
Public Sub insertRow()
Dim row As Integer = m_grid.CurrentCell.RowIndex
Dim col As Integer = m_grid.CurrentCell.ColIndex
dtaProducts.GenProductsCollection.Insert(row - 1, New CGenProductsPricingInfo)
ADAdministrator Syncfusion Team October 14, 2004 10:14 AM
You will not be able to insert rows into a datatable. You can only add them at the end using DataTable.AddNew.
If you need to rearrange the rows, then you can try to set up a DataView ordered on some hidden field that makes the rows appear in the order that you want them. But this will take some work to do.
JLJeff LancasterOctober 14, 2004 10:44 AM
Actually, I am able to insert rows, as I am not bound to a datatable, I am bound to a custom collection implementing iBindingList. I have an insert function which works, it inserts a blank record and the grid is automatically syncing and properly showing the new blank record in the right row.
The problem is, when I use the CurrentCell.Moveto, so as to reposition the highlighter into the new row, it appears to be displaying the data from the old current cell in the new one. If I click off the new current cell and then back on it displays properly.
ADAdministrator Syncfusion Team October 14, 2004 12:07 PM
Before you insert the row, try calling this.grid.CurrentCell.EndEdit() to see if this handles thie problem.