c# - the text of datagridview disappears -
i using telerik control(data grid view) in project. when want add new row in data grid, text of previous rows (bindingsourceservice.datasource = dtservice , bindingsourceunit.datasource = dtunit) disappear. datagridview has 3 combobox column. wrong? please me.
my codes:
public void factorload(object sender, eventargs e) { try { var cb = new categoribll(); datatable dtcategori = cb.getalldatacategori(); bindingsourcecategouri.datasource = dtcategori; } catch (exception ex) { exceptionkeeperbll.logfilewrite(ex); } } private void datagridviewfactorcellvaluechanged(object sender, gridviewcelleventargs e) { try { var row = datagridviewfactor.currentrow; if ((row != null) && (row.cells[0].iscurrent)) { var categoryid = convert.toint32(datagridviewfactor.currentrow.cells[0].value); var sb = new categorioptionbll(); datatable dtservice = sb.servicegetbyid(categoryid); bindingsourceservice.datasource = dtservice; } if ((row != null) && (row.cells[1].iscurrent)) { var serviceid = convert.toint32(datagridviewfactor.currentrow.cells[1].value); var cbi = new costbll(); var dtunit = cbi.costbyid(serviceid); bindingsourceunit.datasource = dtunit; } } catch (exception ex) { exceptionkeeperbll.logfilewrite(ex); } } private void datagridviewfactorcelleditorinitialized(object sender, gridviewcelleventargs e) { try { var row = datagridviewfactor.currentrow; if ((row != null) && (row.cells[0].iscurrent)) { var categoryid = convert.toint32(datagridviewfactor.currentrow.cells[0].value); var sb = new categorioptionbll(); datatable dtservice = sb.servicegetbyid(categoryid); bindingsourceservice.datasource = dtservice; } if ((row != null) && (row.cells[1].iscurrent)) { var serviceid = convert.toint32(datagridviewfactor.currentrow.cells[1].value); var cbi = new costbll(); var dtunit = cbi.costbyid(serviceid); bindingsourceunit.datasource = dtunit; } } catch (exception ex) { exceptionkeeperbll.logfilewrite(ex); } }
it disappear because there 1 value in data source. try adding value data source rather assigning single value.
Comments
Post a Comment