.net - C# Devexpress xtragird with multiple lookupedit in rows -
i developing windows application using c# uses devexpress tools. have grid contains more 1 lookup edit in single row. have bind each row in such manner when first lookup edit changes adjacent lookup edit in same row in bind. can dynamically add rows ' add row' button.
how can bind second lookupedit on change of first lookup edit. on each value change 1 row affected previous should remain same.
i've been stuck days - can me?
thanks in advance.
here workouts
private void legridsubinventory_editvaluechanged(object sender, eventargs e) { gvreservation.posteditor(); gvreservation.updatecurrentrow(); gridview view = gvreservation; var obj = view.getfocusedrow(); int locationid = common.intcast(leoutlets.editvalue); lookupedit sub = (lookupedit)sender; view.setrowcellvalue(view.focusedrowhandle, view.columns["itemid"], -1); view.setrowcellvalue(view.focusedrowhandle, view.columns["itemdesc"], ""); view.setrowcellvalue(view.focusedrowhandle, view.columns["primaryuom"], ""); view.setrowcellvalue(view.focusedrowhandle, view.columns["onhandqty"], 0); view.setrowcellvalue(view.focusedrowhandle, view.columns["onhandqty"], 0); if (sub.itemindex != -1) { int subid = common.intcast(sub.editvalue); if (subid != -1) { datatable dtitems = cdm.getallitemsbysubinventory(locationid, subid); datarow locrow = dtitems.newrow(); locrow["itemid"] = -1; locrow["itemcode"] = "--select--"; dtitems.rows.insertat(locrow, 0); rleitemcode.datasource = dtitems; rleitemcode.displaymember = "itemcode"; rleitemcode.valuemember = "itemid"; } } }
as know lookuedit has same datasource rows.
need update datasource on 2 occasions
1)on focusrowchanged event of gridview
2)on on cellvaluechanged event (for first column)
so inside above events call function updatelokkupdatasource.
inside function focused row(so can read first field) , update datasource
don't forget handle customdisplaytext event of second lookupedit(you need because values not exist in new datasource)
Comments
Post a Comment