我已加载Ultra Grid并使用设置New Column Cell List 以下代码:
UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns[1];
// Create a value list.
ValueList vl1 = new ValueList( );
vl1.ValueListItems.Add( 1, "True" );
vl1.ValueListItems.Add( 2, "False" );
// Set vl1 to the column2. Cells in column2 will use this value list.
column.ValueList = vl1;
我想要vl1.selectedvalue = 2加载默认值,这是我无法实现的。非常感谢任何帮助和指导。
答案 0 :(得分:0)
您需要设置ValueList的SelectedIndex:
ValueList list = new ValueList();
list.ValueListItems.Add(1,"One");
list.ValueListItems.Add(2,"Two");
list.ValueListItems.Add(3,"Three");
list.ValueListItems.Add(4,"Four");
list.SelectedIndex = 2;
list.SortStyle = ValueListSortStyle.AscendingByValue ;
this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].ValueList = list;
我希望这会有所帮助。