therko
therko

Reputation: 69

devexpress GridLookUpEdit into RepositoryItemGridLookUpEdit, or GridLookUpEdit into column cell

I know I can set

//RepositoryItemGridLookUpEdit riglue eePozycje.gvView.Columns[KolNazwa].ColumnEdit = riglue;

but all I have is GridLookUpEdit. How can I set GridLookUpEdit into column cel, or transform GridLookUpEdit into RepositoryItemGridLookUpEdit ?

//DONE I found it in GridLookUpEdit.Properties.

Upvotes: 0

Views: 2528

Answers (1)

Niranjan Singh
Niranjan Singh

Reputation: 18290

Refer the documentation

The RepositoryItemLookUpEdit class contains settings specific to the GridLookUpEdit control. You can access these settings via the editor's GridLookUpEdit.Properties object. See the GridLookUpEdit topic for details on the control.

You need to create repository items as standalone objects only to specify inplace editors for container controls (such as the XtraGrid, XtraTreeList, etc)

I think you that How to Assign Editors for In-Place Editing. Now If you want to set editors in particular cell then you have to handle the GridView.CustomRowCellEdit. The event occurs dynamically for each visible cell and allows you to supply an editor to individual cells, based on the position of the cell (its column and row).

Refer this - Assigning Editors to Individual Cells

example:

using DevExpress.XtraGrid.Views.Grid;

private void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) {
   if (e.Column.FieldName == "FieldName") return;
   GridView gv = sender as GridView;
   string fieldName = gv.GetRowCellValue(e.RowHandle, gv.Columns["FieldName"]).ToString();
   switch (fieldName) {
      case "Population":
         e.RepositoryItem = repositoryItemSpinEdit1;
         break;
      case "Country":
         e.RepositoryItem = repositoryItemComboBox1;
         break;
      case "Capital":
         e.RepositoryItem = repositoryItemCheckEdit1;
         break;
   }           
}

Hope this help.

Upvotes: 1

Related Questions