DevExpress控件之RepositoryItemComboBox

时间:2021-12-27 08:37:57

RepositoryItemComboBox在嵌入到GridView后,如何获取当前所选的Item?

直接代码:

 ((RepositoryItemComboBox)gridView.Columns["ColName"].ColumnEdit).SelectedIndexChanged += new System.EventHandler(ColName_SelectedIndexChanged);
2
private void ColName_SelectedIndexChanged(object sender, System.EventArgs e)
{    //获取所选item的索引
int i = ((DevExpress.XtraEditors.ComboBoxEdit)sender).SelectedIndex;
   //获取所选item的内容
   string currentItem=((DevExpress.XtraEditors.ComboBoxEdit)sender).EditValue.ToString();
}