c# - how to use buttonedit in devexpress gridcontrol -
i trying create gridcontrol buttonedit in 1 of columns. when user clicks button edit, popups form select product. when selection done on popup, returns datarow selection main grid below.
but when column loses focus, value wrote column disappear.
here code creates gridcontrol's data , buttonedit's click event.
private void frmsiparisnew_load(object sender, eventargs e) { dt = new datatable(); dt.columns.add("malzeme_kodu",typeof(string)); dt.columns.add("malzeme_aciklama", typeof(string)); dt.columns.add("adet", typeof(decimal)); dt.columns.add("birim", typeof(string)); dt.columns.add("fiyat", typeof(decimal)); dt.columns.add("kur", typeof(string)); dt.columns.add("tutar", typeof(decimal)); datarow dr = dt.newrow(); dt.rows.add(dr); gc.datasource = dt; } private void repositoryitembuttoneditmalzemekodu_buttonclick(object sender, devexpress.xtraeditors.controls.buttonpressedeventargs e) { frmproducts frm = new frmproducts(dt_products); frm.showdialog(); datarow dr_return = frm.dr; buttonedit buttonedit = (sender buttonedit); buttonedit.text = dr_return["urunkod"].tostring(); }
why value disappear? should first fill datatable , bind again? how can fix this?
it looks button edit not connected intimately hosting grid. see if can assign value underlying grid cell or datatable row value. then, should stick.
Comments
Post a Comment