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;
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,
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.
Hello,
I am not sure that I completely understand what your goal is. Key property of ValueList is inherited from Infragistics.Shared.KeyedSubObjectBase. When customer choose item from ValueList, it will rerun DataValue of the chosen ValueListItem (in your case it will returns “row[0],” )Could you please be more specific about what you want to achieve and what is your goal. Maybe you have need BindableValueList instead a ValueList, for more information about BindableValueList please review the following links:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.v11.1~Infragistics.Win.BindableValueList_members.html
Please let me know if you have any further questions.