Hi there
We are using the Infragistics2.Win.UltraWinGrid.v12.1.20121.2050 in .NET 3.5 WinForms app.
We have noticed a critical exception when using the grid in a particular way.
Our problem occurs when the grid has the
DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect; is set and then later we call cell.Activate() on the cells in an UltraGridRow.
This causes us to receive the following ArgumentException which I have pasted below when we hit the Enter Key whilst on the grid.
It should be noted that the column listed in the exception is NOT really a column at all but is actually a relationship between 2 ADO.NET DataTables!
Exception Type : ArgumentException
Exception Message:Column 'FK_DTResourceDetails_DTResourcePrices' does not belong to table DTResourceDetails.
Stack Trace: at System.Data.DataRow.GetDataColumn(String columnName) at System.Data.DataRowView.System.ComponentModel.IDataErrorInfo.get_Item(String colName) at Infragistics.Win.UltraWinGrid.UltraGridRow.GetDataError(UltraGridColumn column) at Infragistics.Win.UltraWinGrid.UltraGridRow.HasDataError(UltraGridColumn column) at Infragistics.Win.UltraWinGrid.UltraGridRow.ResolveCellAppearance(UltraGridColumn column, AppearanceData& appData, AppearancePropFlags& requestedProps, Boolean cellAppearanceOnly, Boolean forceSelected, ForceActive forceActive, Boolean isMergedCell, Boolean hotTrackingCell, Boolean hotTrackingRow, Boolean isProxyResolution) at Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.OnAfterDraw(UIElementDrawParams& defaultDrawParams) at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams) at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams) at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams) at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams) at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams) at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics) at Infragistics.Win.UIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics) at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics) at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize) at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode) at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe) at Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(PaintEventArgs pe) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(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)
To get around this we now test what the CellClickAction is before attempting to enumerate the cells in the grid row.
Is there a better test for to handle this situation or an alternative to our workaround?
Regards
geoffhop
Hi Geoff,
What cell are you calling Activate on? My guess is that you are trying to activate a cell of a chaptered column.
The relationship in your DataSet will display in the grid as a child band, but the parent band contains a column with that name. So if you loop through the columns of the band and try activating that column/cell, it won't work and it might result in the exception you have here. If that's the case, then the thing to do is check the IsChaptered property on the column and skip those columns - those are the child band columns.
Hi Mike
Thanks a lot for the reply, seems to have worked a treat.