Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
Changing Key in ValueList
posted

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;

                }

Parents Reply Children
No Data