I have sfDataGrid bounded with a model and i have two GridComboBoxColumn with the same value member and different display member and when i add a new record it show the same value! how can i show the according display member for the second gridcomboboxcolumn?
//GridComboBoxColumn populating code
List<ProductModel> model = GlobalConfig.Connection.GetAllProducts(string.Empty, 0, 0);
//Product code
(this.gridViewPurchaseOrderDetail.Columns[3] as GridComboBoxColumn).DataSource = model;
(this.gridViewPurchaseOrderDetail.Columns[3] as GridComboBoxColumn).DisplayMember = "ProductCode";
(this.gridViewPurchaseOrderDetail.Columns[3] as GridComboBoxColumn).ValueMember = "ProductId";
//Description
(this.gridViewPurchaseOrderDetail.Columns[4] as GridComboBoxColumn).DataSource = model;
(this.gridViewPurchaseOrderDetail.Columns[4] as GridComboBoxColumn).DisplayMember = "Description";
(this.gridViewPurchaseOrderDetail.Columns[4] as GridComboBoxColumn).ValueMember = "ProductId";
//Add a new record to the grid
var orderDetailModel = new OrderDetailModel
{
OrderDetailId = 0,
OrderId = _orderId,
Quantity = 1,
ProductId = selectedProduct.ProductId,
UnitCost = selectedProduct.UnitCost,
Tax = selectedProduct.Tax,
TaxRate = GetTaxRateByName(selectedProduct.Tax)
};
var record = this.gridViewPurchaseOrderDetail.View.CreateRecordEntry(orderDetailModel);
this.gridViewPurchaseOrderDetail.View.Records.Add(record);
Attachment:
Screenshot_ec3cd71c.rar