I have a grid which has two columns and the the first column has a lookupedit. I can fill the grid and the lookupedits but my problem is I dont know how to set the selectedtext according to the database?
here is how I fill the grid and the lookupedit
private void fill_budget_settings(){
fill_tanim_lookupedit();
gc.DataSource = dataContext.getObjectList("RN_BUDGET_SETTINGS", "*", 0, "", "", 0, 0);
gv.BestFitColumns();
}
private void fill_tanim_lookupedit()
{
int cnt = gv.DataRowCount;
lookUpEditTanim = new RepositoryItemLookUpEdit();
lookUpEditTanim.DataSource = dataContext.getObjectList("RN_BUDGET_SETTINGS_VARIABLES", "*", 0, "", "", 0, 0);
lookUpEditTanim.ValueMember = "VARIABLE";
lookUpEditTanim.DisplayMember = "VARIABLE";
gv.Columns[0].ColumnEdit = lookUpEditTanim;
}
when the form is loaded, grid gets filled, lookupedits get filled but lookupedits dont get selected with data required according to the database. how can I do that?
If you want to show editor value according to cell value then specified column to
ValueMember
Property must contain that value which is currently in the cell.For Example:
In the specified screen shot, Tanm Column have variable id and your want to show variable name in the column then
ValueMember
field should be the ID andDisplayMember
should beVariable
.Example code snippet:
If you are not doing as above and want to get value according to column cell. then you must take the Inplace Editors Overview and check the
See Also
section in the page and there you will get one Assigning Editors to Individual Cells.Example: