Hi,
I've bound an Ultragrid column right now to a valuelist like so:
ValueList _myList = _myGrid.TheGrid.DisplayLayout.ValueLists.Add("MyList"); _myList.ValueListItems.AddRange(Enumerable.Select(_vm.Model.MyItems, al => new ValueListItem(al.ID, al.NAME)).ToArray()); _myList.TheGrid.DisplayLayout.Bands[0].Columns["MyListColumn"].ValueList = _myList;
However I'm only interested in the DisplayText/string part of the list. While selecting and saving, I do NOT want it to automatically convert it to the underlying number.
Is there no way to bind the column to a simple list of strings?
Hello Huzan,
Thank you for contacting Infragistics. In cases If the underlying bound column's datatype does not match the datatype of the value item member selected in the dropdown then this will certainly cause issues. You should probably use an Unbound column otherwise.
Each ValueListItem exposes a ValueListItem.DataValue property, which corresponds to the underlying value, and a ValueListItem.DisplayText property, which corresponds to the string that is displayed to represent the item in the user interface to facilitate your requirement. For more examples you can refer to this topic:https://ko.infragistics.com/community/product_platforms/winforms/w/winforms-wiki/3/best-practices-for-placing-a-dropdown-or-combo-in-an-wingrid-cell
Let me know if you have any questions.
Or else is there a way i can typecast the value to the display string?