c# - Setting the Selected Value on DatagridView.ComboboxColumn -
i trying complete form grid loaded programmatically.
the grid has 6 columns , last column combobox
this part of code
foreach(var persona in asistenciarepo.filterby(x => x.plaserv == planilla).orderby(x => x.orden)) { grilla_personal.rows.add(persona.personal.id, persona.personal.id_legajo, persona.jerarquia.descripcion, persona.personal.nomyape, persona.orden, persona.codificacion.descripcion); }
basically i'm trying when grid loaded , displays selection combobox stored in entity
the persona.codificacion.descripcion
column of entity contains data wish link control.
it necessary handle event selectedvaluechanged
or way correctly.
[update]
column 6 loaded programmatically
foreach (var c in codifrepo.getall()) { codificacion.items.add(c); } codificacion.valuemember = "id"; codificacion.displaymember = "descripcion";
codificacion
name of comboboxcolumn
your datagridviewcomboboxcolumn needs have datapropertyname property set.
this tells column property in datagridview's datasource use each comboboxes selected value.
you need have provided datasource combobox column itself, specifies list of values in drop down.
the columns valuemember , displaymember properties need set too. valuemember property in column's datasource matches datapropertyname property. displaymember property display users.
if aren't using datasource grid, i'd recommend - add each row's values bindinglist , set grid's datasource.
Comments
Post a Comment