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://www.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,
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.
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.
Hi, Milko,
I'm afraid I had to go with writing a quick and dirty function to dump all the data out to a DataTable.
I couldn't get around the issue I was having, but I also couldn't reproduce it using anything other than our data objects, so I guess the problem must be with them.
You can consider this question closed.
I am having the same issue. The code is very simple.
public partial class KitMaintenanceView : UserControl {
public KitMaintenanceView() { InitializeComponent(); _valueListParts = new ValueList {FormatString = string.Empty}; _valueListParts.ValueListItems.Add(1, "First item"); ValueListItem item = new ValueListItem(2,"Second item"); _valueListParts.ValueListItems.Add(item); setupHandlers(); }
private void grdKit_InitializeLayout(object sender, InitializeLayoutEventArgs e) { e.Layout.GroupByBox.Hidden = true; e.Layout.TabNavigation = TabNavigation.NextControlOnLastCell;
// Resize columns to width of grid e.Layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
e.Layout.Override.CellClickAction = CellClickAction.Edit; e.Layout.Override.AllowAddNew = AllowAddNew.FixedAddRowOnTop; e.Layout.Override.AllowUpdate = DefaultableBoolean.True; e.Layout.Override.AllowDelete = DefaultableBoolean.True;
UltraGridBand bandKit = e.Layout.Bands[0]; UltraGridBand bandParts = e.Layout.Bands[1];
// Make row selectors visible bandKit.Override.RowSelectors = DefaultableBoolean.True; // Customize the appearance of the row selectors. e.Layout.Override.RowSelectorAppearance.BackColor = Color.Cyan;
// Hide columns parent band bandKit.Columns["Id"].Hidden = true;
// Hide columns child band bandParts.Columns["Id"].Hidden = true; bandParts.Columns["KitId"].Hidden = true;
// Set Column descriptions, widths & appearances for child band bandParts.Columns["PartId"].Width = 450; // band.Columns["PartId"].SortIndicator = SortIndicator.Ascending; bandParts.Columns["PartId"].Header.Caption = "Description"; bandParts.Columns["PartId"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; bandParts.Columns["PartId"].ValueList = _valueListParts;
bandParts.Columns["Quantity"].CellAppearance.TextHAlign = HAlign.Right; bandParts.Columns["Quantity"].Format = "###,##0.00"; bandParts.Columns["Quantity"].MaskInput = "999999.99"; bandParts.Columns["Quantity"].Width = 70; }
private void setupHandlers() { grdKit.InitializeLayout += grdKit_InitializeLayout; }
}
Hello Lars,
Thank you for posting in our forum.
Following the steps you have described and using the code snippet you have provided I have implement a custom control. I have populated this custom control with some sample data and have added in a sample Windows Forms application. I have run my sample application and I did not have any zeros in my grid. Please note my test application was build with latest version of Infragistics Controls 15 Volume 1, 15.1.20151.2013.
I am sending you my sample project in order to test it on your machine, and let me know if you experience the same issue or not. If the issue appears again this could be because of different version of Infragistics Controls we are using, so please let me know the exact version of your controls. If the issue does not appear this could be an issue in your code, so please try to send me an small isolated sample demonstrating this behavior. If you do not have such sample please fill free to modify my sample solution to match your scenario and send it back to me.
Looking forward to your reply.