Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
UltraWinGrid data exception with empty message
posted

In the process of upgrading one of our applications to the IG9.2 release, some of our data validation on the UltraGrid was broken.  The problem occurs when the System.Data.DataColumn on the grid data source does not allow nulls and you null the field out in the grid.  We are doing some custom work in the CellChange event that calls e.Cell.Row.Update() if the e.Cell.IsDataCell property is true.  We have the DisplayLayout.Override.SupportDataErrorInfo property set to SupportDataErrorInfo.RowsAndCells.  Prior to the 9.2 upgrade, you could null the column and the error provider from the dataset would be displayed in the cell and row selector.  Now, an exception is thrown and the message on the exception is empty.  Here is the stack trace from the Exception.

   at Infragistics.Win.UltraWinGrid.UltraGridCell.CommitEditValue(Boolean& stayInEdit, Boolean fireDataError, Boolean forceDontThrowException, Boolean dontStoreInUndoHistory)
   at Infragistics.Win.UltraWinGrid.UltraGridCell.CommitEditValue(Boolean& stayInEdit, Boolean fireDataError, Boolean forceDontThrowException)
   at Infragistics.Win.UltraWinGrid.UltraGridRow.Update(DataErrorInfo& error)
   at Infragistics.Win.UltraWinGrid.UltraGridRow.Update()
   at UltraWinGridDemoApp.Form1.ultraGrid1_CellChange(Object sender, CellEventArgs e) in C:\Users\calste.THADMIN\Documents\Visual Studio 2008\Projects\UltraWinGridDemoApp\UltraWinGridDemoApp\Form1.cs:line 42

Do you have any ideas or suggestions on how to avoid this?  Otherwise, we won't be able to use the 9.2 Version.  I have attached a sample dummy app that demonstrates the custom CellChange code we are doing.  If you null out the data in the NAME field on the grid, you will get a message box with an empty message representing the exception message.  Any help would be appreciated.

UltraWinGridDemoApp.zip
  • 469350
    Verified Answer
    Offline posted

    Hi,

    This looks like a bug to me. I'm going to forward this thread over to Infragistics Developer Support so they can check it out and get it corrected.

    I think what happened here is that we made some changes to the behavior of the Nullable property on the column. It defaults to Automatic and in this case, it used to try to write an empty string into the column, but now it's trying to write DBNull instead, and failing.This might have been an intentional change, but I don't think so, and we should avoid changing existing behavior whenever possible, so it's definitely something we need to investigate in more detail.

    The good news is that there is a very easy workaround:


        private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            e.Layout.Bands[0].Columns["NAME"].Nullable = Infragistics.Win.UltraWinGrid.Nullable.EmptyString;

        }