开发者

Selected value of DataGridViewComboBoxCell

开发者 https://www.devze.com 2023-03-29 04:58 出处:网络
I am using t开发者_如何学运维he following code to bind a combo box column in gridview DataGridViewComboBoxCell dgBatch = (DataGridViewComboBoxCell)grvProduct.Rows[pRowIndex].Cells[pComboColName];

I am using t开发者_如何学运维he following code to bind a combo box column in gridview

DataGridViewComboBoxCell dgBatch = (DataGridViewComboBoxCell)grvProduct.Rows[pRowIndex].Cells[pComboColName];
            DataTable dtBatch = new DataTable();
            dtBatch = iExportSalesOrder.SelectProductDetails(pack_detl_ID);
            dgBatch.DataSource = dtBatch;
            dgBatch.ValueMember = "qty";
            dgBatch.DisplayMember = "sBatch_No";

I want to set a particular item as selected in this combo box based on some value. How can i set a selectedvalue in DataGridViewComboBoxCell .?


Set dgBatch.Value = "selectedValue" it should work.


dgBatch[Column.Name, Row.Name].Value = value;
0

精彩评论

暂无评论...
验证码 换一张
取 消