I am using infragistics v7.2. I am facing problem with the UltraGrid. If I click on the TemplateAddRow, do not enter anything and click back to an another row, then the grid will cancels the row by calling CancelEdit mehtod. This deletes the row from datasource. But the row will remain visible on ultragrid. Now if user edits this row and move to new template row that is created at bottom of grid, the changes user made in previous row are lost.
My datasource implements IBindingList.
Please help.
Following is the statck trace.
TestNamespace.TableRowCollection.RemoveAt(Int32 index) at System.Windows.Forms.CurrencyManager.RemoveAt(Int32 index) at Infragistics.Win.UltraWinGrid.UltraGridRow.DeleteHelper() at Infragistics.Win.UltraWinGrid.UltraGridRow.CancelEdit() at Infragistics.Win.UltraWinGrid.UltraGrid.OnActiveRowCleared(Boolean update) at Infragistics.Win.UltraWinGrid.UltraGridBase.SetActiveRow(UltraGridRow row, Boolean scrollIntoView) at Infragistics.Win.UltraWinGrid.UltraGridCell.Activate() at Infragistics.Win.UltraWinGrid.UltraGridCell.SetFocusAndActivate(Boolean byMouse, Boolean enterEditMode, Boolean byTabKey) at Infragistics.Win.UltraWinGrid.UltraGridCell.SetFocusAndActivate(Boolean byMouse, Boolean enterEditMode) at Infragistics.Win.UltraWinGrid.CellUIElementBase.OnEmbeddableElementMouseDown(Object sender, EmbeddableMouseDownEventArgs e) at Infragistics.Win.UltraWinGrid.GridEmbeddableEditorOwnerInfoBase.OnEditorMouseDown(EmbeddableUIElementBase embeddableElem, EmbeddableMouseDownEventArgs e) at Infragistics.Win.EmbeddableUIElementBase.RaiseMouseDownEvent(EmbeddableMouseDownEventArgs e) at Infragistics.Win.FormattedLinkLabel.FormattedTextUIElement.ProcessMouseDownHelper(EmbeddableUIElementBase editorElem, MouseEventArgs mouseArgs, Boolean adjustableArea, UIElement& captureMouseForElement, Boolean& notifyParent) at Infragistics.Win.FormattedLinkLabel.FormattedTextUIElement.OnMouseDown(MouseEventArgs mouseArgs, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnMouseDown(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.NativeWindow.WndProc(Message& m) at Infragistics.Win.EditorWithMask.AccessibleTextManager.AccessibleTextSubclasser.WndProc(Message& msg) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.NativeWindow.WndProc(Message& m) at Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor.AccessibleTextManager.AccessibleTextSubclasser.WndProc(Message& msg) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
What is your grid's DataSource? You say it implements IBindingList... does that mean this is a custom object where you implemented IBindingList yourself? If so, then my guess is that your IBindingList implementation is not sending the property notifications after the row is cancelled.
Thanks Mike for reply.
My grid datasource is custom object which implements IBindingList. I tried your suggestion and it worked. I used ListChanged event for the notification. Now I have another problem.
Template row is added to grid when user edits the last row. When user clicks in template row, new row will be added to datasource. If user moves out of templaterow without making any changes, the row will be deleted from datasource. Using event notfication, grid will also delete the template row. Now problem is if user wants to add new row, he has to edit the last row again so that template row is available and he can enter the values in template row.
Is there any workaround for this problem?
Once again, this sounds like a problem with your IBindingList notificaitons. When the AddNewRow is cancelled, the AddNewRow should be remove, but the TemplateAddRow should not. This is the way it works with any of the standard data sources like a DataTable or UltraDataSource.
Hi Mike,
you were right, the problem was in notification. I was not raising the event OnListChanged from the RemoveAt Method.
Thanks and Regards,
Sambhaji