I have an ultra grid which I am binding to a list of objects. As part of the grid, I have an unbound column to which I have a lookup to a list of values. I want this list to allow a null value or at least the unbound column I am trying to set.
To do this I am using an UltraCombo which is set in my form. I set this to the unbound column using the following code in Grid InitializeLayout:
e.Layout.Bands(0).Columns("User").ValueList = Me.UserCombo1 e.Layout.Bands(0).Columns("User").Style = ColumnStyle.DropDown e.Layout.Bands(0).Columns("User").Nullable = Infragistics.Win.UltraWinGrid.Nullable.Nothing e.Layout.Bands(0).Columns("User").DataType = GetType(User)
Notable properties set on the UltraCombo are:
AllowNull = trueDropDownStyle - tried DropDown and DropDownListLimitToList = false
I set the unbound column in Grid InitializeRow event.
When the I drop the combo down, there is nothing I can see to set a null value.
I have tried adding a Nothing (null) value to my data source which is basically List(Of User). This shows up in the list. However, when I select it and change row, it appears to select the original value in the drop down. All seems to get set correctly in AfterCellUpdate, but it fires twice - first with the null selection then the initial value.
Any thoughts? I've been looking at this for over a day and a half and cannot fathom it out.
Thanks
Andez
Thanks for your response. If you need any additional assistance don’t hesitate to ask.
Hi Mike,
Thanks for the info about checking the Reinitialize flag.
However, I was being silly and not actually storing the value when it had changed. It all works fine now. Can't believe I'd spent days on this!
Cheers,
Hi Andez,
Paul Anderson said:I set the unbound column in Grid InitializeRow event.
What exactly are you doing in InitializeRow? What does "set the unbound column" mean? If you are changing the value of the grid cell in InitializeRow, then that's probably the problem. InitializeRow will fire any time any value in that row changes, so it will end up re-setting the cell back to the original value. You probably need to check e.ReInitialize so you only set the cell's value the first time and not every time.