Hi,
I am using a UltraWinGrid and need to set a ValueList to a column, however the Data Source does not have a regular Id, Value but Name,Value, i tried looking for DataMember, ValueMember properties but no luck. i also tried to change Key property no luck again. this is my code:
UltraGrid grid = (UltraGrid)gridDefinition.Grid;
ValueList valueList = null;
if (source != null)
{
valueList = new ValueList();
valueList.Key = source.Columns[0].ColumnName;
foreach (DataRow row in source.Rows)
valueList.ValueListItems.Add(
new ValueListItem()
DataValue = row[0],
DisplayText = row[1].ToString(),
});
}
grid.DisplayLayout.Bands[0].Columns[columnKey].ValueList = valueList;
Hello,
I am just checking about the progress of this issue. Let me know If you need my further assistance on this matter?
Thank you for using Infragistics Components.
Hi and thanks for the reply.
I have a wingrid where some columns are "ComboBox" type, i fill the data source for these columns by filling the Value List. My data source is always a DataTable, the first column Key is "ID" and the second column Key is "Name" when i work like that the description inside the column is displayed correctly. however if i use a different Key for the first column ("VALUE" instead of "ID") the description is not displayed.
my question was why? and how can i tell the value list that it's "VALUEMEMBER" is "VALUE" and not "ID"?
Hello Itamarbe,
We are still following this forum thread.Please feel free to let us know if you still need further assistance with it.
If you are populating a ValueList in code, then you set the DataValue and DisplayText of each ValueList item on the list when you add the item. The ValueListItems.Add method takes both. And this is shown in the very first post of this thread.
If you are using another kind of ValueList which is bound, such as UltraCombo, UltraDropDown, or BindableValueList, then any of these have both a DisplayMember and a ValueMember proprerty on them.
There is no VAlueMember, DisplayMember properties in 'ValueList', that is the reason i tought that maybe 'Key' property replace "traditional" valuemember.
I just wanted to know if you were able to solve your issue based on Mike's suggestions or you still need help? Just let me know.
Thank you.
Itamarbe said:how can i tell the value list that it's "VALUEMEMBER" is "VALUE" and not "ID"?
Set the ValueMember and DisplayMember properties. It uses the first column for both of these only if you do not specify anything.
If are you are setting these properties, then my guess is that you are setting them in code and referencing the columns by index instead of by key.