Hi All,
I am using DataGridview and there is a Combobox column is present in the datagrid.
I am binding the DataGridViewCom boboxcolumn with a DataSource.
DataGridViewCom boBoxColumn cmbInstType = (DataGridViewCo mboBoxColumn)gr dCashMemoDetail s.Columns["grdCashMemoDet ailsInstrumentT ype"];
DataTable instType = new DataTable();
instType.Column s.Add("Value", typeof(int));
instType.Column s.Add("Display" , typeof(String)) ;
instType.Rows.A dd(1,"Cash");
instType.Rows.A dd(2,"Card");
instType.Rows.A dd(3,"DD");
instType.Rows.A dd(4,"Cheque");
cmbInstType.Dis playMember ="Display";
cmbInstType.Val ueMember ="Value";
cmbInstType.Dat aSource = instType;
Now I want to set the default selected value for the combobox as
grdCashMemoDeta ils.Rows[e.RowIndex].Cells[(
int)enmGridView ColumnIndex.Ins trumentType].Value = 2; But this is not working.
Please guide me how to do this.
Gyanendar
I am using DataGridview and there is a Combobox column is present in the datagrid.
I am binding the DataGridViewCom boboxcolumn with a DataSource.
DataGridViewCom boBoxColumn cmbInstType = (DataGridViewCo mboBoxColumn)gr dCashMemoDetail s.Columns["grdCashMemoDet ailsInstrumentT ype"];
DataTable instType = new DataTable();
instType.Column s.Add("Value", typeof(int));
instType.Column s.Add("Display" , typeof(String)) ;
instType.Rows.A dd(1,"Cash");
instType.Rows.A dd(2,"Card");
instType.Rows.A dd(3,"DD");
instType.Rows.A dd(4,"Cheque");
cmbInstType.Dis playMember ="Display";
cmbInstType.Val ueMember ="Value";
cmbInstType.Dat aSource = instType;
Now I want to set the default selected value for the combobox as
grdCashMemoDeta ils.Rows[e.RowIndex].Cells[(
int)enmGridView ColumnIndex.Ins trumentType].Value = 2; But this is not working.
Please guide me how to do this.
Gyanendar