DevExpress控件之RepositoryItemComboBox
RepositoryItemComboBox在嵌入到GridView后,如何获取当前所选的Item?
直接代码:
1 ((RepositoryItemComboBox)gridView.Columns["ColName"].ColumnEdit).SelectedIndexChanged += new System.EventHandler(ColName_SelectedIndexChanged);
2 3 private void ColName_SelectedIndexChanged(object sender, System.EventArgs e) 4 { 5 6 //获取所选item的索引 7 int i = ((DevExpress.XtraEditors.ComboBoxEdit)sender).SelectedIndex; 8 //获取所选item的内容 10 string currentItem=((DevExpress.XtraEditors.ComboBoxEdit)sender).EditValue.ToString(); 11 }
每天进步一点点!