This doesn't sound like correct behavior to me.
My first thought is that your application may be doing something that causes the grid to scroll upward as a side effect. Possible such causes include resetting the grid's data source, doing anything that causes a Reset notification to be set through the Windows Forms binding manager, or explicitly programmatically scrolling the grid.
Can you provide more information as to what kind of object your grid is bound to (DataSet, custom collection, generic collection, etc.), and which of the grid's events you have handled?
Hi Vince,
In grid I handle the enter key keypress with this code:
GridPrev.ActiveCell.EditorResolved.ExitEditMode(true, true);
This code allow to commit row (hide the little pen on row selector) and exit from edit mode on cell.
In debug I have try to comment, without behaviour changes grid scrol always up, one of this but i need both.
If I comment both CommitRow and ExitEditMode, grid has correct behaviour.
help me please, I don't understant.
thank you very much
Hi,
your code work fine, but the in the row selector appear the little pencil, how to remove it if the row isn't the active row ?
I have many code that work with datatable, and not with row cells values. My grid is very complex, it consist of 5 bands and calculated values in cascade from the most deeph band to to the first band, and vice versa. There is a way to bypass wath you say :
"The modification of the parent row may be causing the child rows to be discarded and recreated, possibly because of the way the BindingManager sends notifications to the grid. The grid would scroll up to the parent row as a side-effect"
I need only disable the scroll-effect.
Thank you very much.
tosatoandrea said:your code work fine
tosatoandrea said:but the in the row selector appear the little pencil, how to remove it if the row isn't the active row
UltraGridRow row = ultraGrid1.ActiveRow;while (row.ParentRow != null){ row = row.ParentRow; //DataRow dr = ((DataRowView)row.ListObject).Row; //if (dr != null) // dr["descrizione"] = "descrizione " + r.Next().ToString(); row.Cells["descrizione"] = "descrizione " + r.Next().ToString(); row.Update(); }}
The pencil icon means that there are changes made to the grid row that haven't yet been committed to the corresponding data row. By calling the grid row's Update() method, you're telling the row to commit those changes to the data row. This should remove the pencil icon, or likely prevent it from appearing in the first place.
Hi, thanks for reply!
Modify grid cells directly : (ex. row.Cells["descrizione"] = "descrizione " + r.Next().ToString() ) NO SCROLL, but pencil appear in all rows modified.
But if I add row.Update() pencil disapper, rows are committed, but there is scroll up !!!
The best thing for me would be directly edit the datasource to occur without the scroll up.
I think it strange that there is no way to avoid the scrol up the grid if the modify occur in datasource (and in fields that not are primary
key of relation between datatables).
I tried also to use BeginUpdate () and SuspendRowSynchronization () without success.
tosatoandrea said:But if I add row.Update() pencil disapper, rows are committed, but there is scroll up !!!
This issue is likely to take more in-depth research than I am able to provide over the forums. I've passed this information over to Developer Support so that we can continue to assist you on this issue through a support request. The first thing that DS will likely do is to put together a sample project to attempt to reproduce the behavior you've described.
Thanks for your patience.
ok thanks,
I have a sample project (vs2008, grid 2008.3) that reproduce the problem, if you want, I can send it.
I look forward to news.
thanks to you
I've found the support case that was raised in relation to this thread. Here's a summary:
The behavior is expected because these changes to the data source caused focus to be put elsewhere in the grid. The grid will scroll to bring the active cell/row into view.
As a solution, the above code for the AfterExitEditMode event handler was modified to save a reference to the originally-active row and to activate it again.
using Infragistics.Win.UltraWinGrid;....private void ultraGrid1_AfterExitEditMode(object sender, EventArgs e){ Random r = new Random(); ultraGrid1.ActiveRow.Cells["descrizione"].Value = "descrizione " + r.Next().ToString(); UltraGridRow row = ultraGrid1.ActiveRow; UltraGridRow getRow = ultraGrid1.ActiveRow; while (row.ParentRow != null) { row = row.ParentRow; DataRow dr = ((DataRowView)row.ListObject).Row; if (dr != null) dr["descrizione"] = "descrizione " + r.Next().ToString(); } getRow.Activate();}
base4it, does this help resolve your issue? If not, then I recommend that you submit a support reuqest and attach the sample you're mentioning.
Has this issue been fixed? We have a similar problem in our project. Our grid looks like this:
GirdParentRow
GridChildRow1
GridChildRow2
GridChildRow3
GridChildRow3 is the active row. Our code modifies the DataRow behind GridParentRow. After that GridChildRow1 gets selected. We can provide a sample project if needed.
Sample contains the two approach, modify by cell and datasouce.
Thank you - a sample will be very helpful for our research.
The support request hasn't been logged yet, so you can post the sample in this thread. The Options tab provides a way to attach the file.