repositoryItemComboBox没有SelectedIndex属性的处理办法

You can set the selected index property of the RepositoryItemComboBox in the InitNewRow event as follows:

 
private void gridView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e)
        {
            gridView.SetRowCellValue(e.RowHandle, viewAddColumns.Columns["colFieldName"], (((RepositoryItemComboBox)gridView.Columns["colFieldName"].ColumnEdit).Items[0]));
            
        }


You can also retrieve the value of the selectedindex of the RepositoryItemComboBox by handling SelectedIndexChanged event of the same. as:

((RepositoryItemComboBox)gridView.Columns["ColName"].ColumnEdit).SelectedIndexChanged += new System.EventHandler(ColName_SelectedIndexChanged);

in load event and defining event as follows

         private void ColName_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            int i = ((DevExpress.XtraEditors.ComboBoxEdit)sender).SelectedIndex;
        }

posted @ 2011-10-10 15:25  心随灵动  阅读(1930)  评论(0编辑  收藏  举报