Hi,
I've got an UltraWinGrid hooked up to a BindingSource.
One of my source's columns/properties is of type Nullable(Of Integer).
I have set the column's ValueList property, and the ValueList includes an entry generated by the line "ValueList.ValueListItems.Add(DBNull.Value, "")"
I have set the following settings on the Column:
Column.ValueList = MyValueList Column.NullText = String.Empty Column.Format = String.Empty Column.Nullable = Infragistics.Win.UltraWinGrid.Nullable.Nothing Column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList Column.Header.Caption = "myCaption"
In my dropdown, when the list is dropped down, the blank value shows as an empty option in the list. If I select this option and the cell is still selected, an empty cell is displayed.
When I click off the list, the cell suddenly displays a "0". When I re-focus the cell and the dropdown opens again, the 0 is still displayed in the cell itself, but the entry in the dropdown list is still a blank entry. Clicking on the blank entry again blanks the cell again, until it loses focus, when it displays 0 again.
I've searched the forum and I can't find any solution except for this guy http://ko.infragistics.com/community/forums/t/75962.aspx and he doesn't say how he solved his problem.
EDIT: I've just noticed that the "DisplayString" of the ValueList item is being set to "0" instead of an empty string, which I suspect is the root of the problem, but I'm not sure how to deal with it.
Hello Kristian,
I am just checking about the progress of this issue. Let me know if you need my further assistance on it.
Thank you for using Infragistics Components.
Thank you for your feedback.
DisplayString property of ValueListItem represents the DataValue as string, e.g. DataValue.ToString(). If you set the DisplayText property of ValueListItem to null or empty string the DisplayString will be shown instead of the DisplyText. If you actually need to display empty string as display text in your ValueList you may set the DisplayText property to “ “ (a white space).
Please let me know if you have any further questions.
Hmm...
I have played with your solution Miko, thank you for providing it.
I have found that the following code will reproduce what I am seeing in the debugger:
Dim NullValue As New ValueListItem(DBNull.Value, String.Empty) NullValue.DataValue = 0 MyValueList.ValueListItems.Add(NullValue)
Observing NullValue in Visual Studio shows me that DataString is set to "0" and DataText is set to String.Empty.
However, when the dropdown is displayed, both the dropdown and the cell display "0". In my project, only the cell displays "0".
Strange.
Thanks for your reply, Miko.
As I said in my last posting, the .DisplayText property of the problematic ValueListItem always remains as String.Empty. The issue appears to be the Friend ReadOnly Property DisplayString, which is somehow getting set to "0", even though DisplayText remains as String.Empty.
Thank you for contacting Infragistics Support.
To set the ValueList item display text you may use a code like this:
MyValueList.ValueListItems(10).DisplayText = String.Empty
where 10 is the index of the item with value of Null in your value list items collection. More about ValueList you can find by following the next link http://help.infragistics.com/Help/Doc/WinForms/2014.2/CLR4.0/HTML/Infragistics4.Win.UltraWinGrid.v14.2~Infragistics.Win.UltraWinGrid.UltraGridColumn~ValueList.html
Please find attached a sample solution and let me know if this is what you are looking for or if I am missing something.