Sunday, 15 July 2012

c# - How to populate the DataGridViewComboBoxColumn -



c# - How to populate the DataGridViewComboBoxColumn -

i have datagridviewcomboboxcolumn in datagridview , want populate using linq in run-time:

i seek this

var line = li in dbdata.production_lines select li; grdemp.rows.add(); (grdemp.rows[count].cells["line"] datagridviewcomboboxcell).datasource = line; (grdemp.rows[count].cells["line"] datagridviewcomboboxcell).valuemember = "l_id"; (grdemp.rows[count].cells["line"] datagridviewcomboboxcell).displaymember = "l_id";

but didn't work. how bind info combobox in datagridview

try :

datagridviewcomboboxcolumn combo = (datagridviewcomboboxcolumn)grdemp.columns["line"]; combo.datasource = line; combo.valuemember = "l_id"; combo.displaymember = "l_id"; // suspect should text column

c# winforms linq datagridview

No comments:

Post a Comment