I have a grid with a column set to an UltraDropDown in DropDownValidate style.The combo represent a list of category, the underlying data is a nullable integer.Null is a valid value that means "All the category".
The underliyng data of the grid is a typed list of a Class, the column are the properties of this class.The underliyng data of the UltraDropDown is a typed list of another Class.
The issue is when I have a row with a category set to something, and I want to reset this row to "All categories". When I select the "All" from the dropdown list, and then change cell, the grid tell me "Unable to update the data value: Value in the editor is not valid.". It doesn't accept the value, ed keep me locked in the cell.It weird because when I load the data from the DB, id a row have a null category, the UDD correctly show "All".
Here is the sample code to reproduce the issue:Create a new form, create a new ultragrid in this form, and then paste the following code.(it works only in VS 2010 because I use automatic implemented property in VB)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Imports Infragistics.Win.UltraWinGridImports Infragistics.Win.UltraWinEditorsPublic Class frmUltraGridComboNullIssue Private Class GridData Property IdKey As Integer Property IdCategoryData As Integer? End Class Private Class Category Property IdCategoryLookup As Integer? Property CategoryDesc As String End Class Dim listGrid As New List(Of GridData) Dim listLookup As New List(Of Category) Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. Init() End Sub Private Sub Init() Try listGrid.Add(New GridData With {.IdKey = 1, .IdCategoryData = 10}) listGrid.Add(New GridData With {.IdKey = 2, .IdCategoryData = 20}) listGrid.Add(New GridData With {.IdKey = 3, .IdCategoryData = 30}) listGrid.Add(New GridData With {.IdKey = 4, .IdCategoryData = Nothing}) 'listGrid.Add(New GridData With {.IdKey = 5, .IdCategoryData = New Nullable(Of Integer)}) listLookup.Add(New Category With {.IdCategoryLookup = 10, .CategoryDesc = "Category 10"}) listLookup.Add(New Category With {.IdCategoryLookup = 20, .CategoryDesc = "Category 20"}) listLookup.Add(New Category With {.IdCategoryLookup = 30, .CategoryDesc = "Category 30"}) listLookup.Add(New Category With {.IdCategoryLookup = 40, .CategoryDesc = "Category 40"}) listLookup.Add(New Category With {.IdCategoryLookup = Nothing, .CategoryDesc = "(ALL - nothing)"}) 'listLookup.Add(New Category With {.IdCategoryLookup = New Nullable(Of Integer), .CategoryDesc = "(ALL - nullable)"}) Me.UltraGrid1.SetDataBinding(listGrid, "") Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub uGrid_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout Try Dim dropDown As New UltraDropDown dropDown.ValueMember = "IdCategoryLookup" dropDown.DisplayMember = "CategoryDesc" dropDown.SetDataBinding(listLookup, "") e.Layout.Bands(0).Columns("IdCategoryData").ValueList = dropDown e.Layout.Bands(0).Columns("IdCategoryData").Style = ColumnStyle.DropDownValidate Catch ex As Exception MsgBox(ex.Message) End Try End SubEnd Class
------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------
I've tried many variations for the dropdown:using a datatable for the dataSource, using anonymous type for the datasource, using object / integer / Nullable(of integer) /nothing / DBNull in the ID columnNothing works, the sample code show the best results.The underlying data of the grid must be a class, this can't be changed, it's our entity-based DAL.
Thank, Massimiliano
Hi,
What version of the grid are you using? I'm pretty sure there was a bug where the grid wasn't properly dealing with nullable types in cases like this. That bug was fixed a while ago. So you could get try getting the latest service release and see if that corrects the issue.
How to get the latest service release - Infragistics Community
Or, if you don't want to do that, try setting the Nullable property on the grid column to Nothing.
If none of that works, see if you can create a small sample project demonstrating the issue so we can check it out. It's very hard to create a working sample from a code snippet like you have here, because it's missing all kinds of information like what version of the controls you are using.
there's any news?
Sorry, it looks like whatever problem we were having with our forums which prevented you from attaching your sample also prevented the forum from sending a notification that you posted a reply.
I took a look at your sample and it looks like the grid is, for some reason, trying to update the value of the cell using the text rather than the Value. It has something to do with the fact that the value is null. The grid seems to be getting confused by this and interpreting null to mean that it failed to convert the value into the columns data type - even though null is perfectly valid in this case. This appears to be a bug, so I'm going to send this over to Infragistics Developer Support so they can check it out.
Ok, Thank you very much.
How will I know if/when the bug will be fixed?
Hello,
I have created the following case for you: CAS-56292-0C0TK3. I will notify you through the case when we have more information about you issue.
Please let me know if you have any further questions.
Hello westm0wl,
I would like to let you know that this has been fixed in version 10.3.20103.2039 and above. So downloading the latest service release for 2010 vol3 from our web site should contain the fix of this issue.
Please let me know if you are still experiencing the same issue after applying the latest service release in your application.
I am having this same issue on an UltraWinGrid 10.3 in VS 2010. Danko Valkov indicated that he had created a case to fix this bug. Has there been any progress? Is there an expected release date of the next version that would incorporate this fix?
Thank you very much