private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.InvoicePODetail> details = this.bindingSourceInvoicePODetail.DataSource as IList <Model.InvoicePODetail>; if (details == null || details.Count < 1) { return; } Model.Product p = details[e.ListSourceRowIndex].Product; switch (e.Column.Name) { case "gridColumn7": e.DisplayText = p == null ? "" : p.Id; break; case "gridColumn8": e.DisplayText = p == null ? "" : p.ToString(); break; case "gridColumn9": e.DisplayText = details[e.ListSourceRowIndex].DepotPosition == null ? "" : details[e.ListSourceRowIndex].DepotPosition.ToString(); break; } }
private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.ProduceMaterialExitDetail> list = this.bindingSourceProduceMaterialDetails.DataSource as IList <Model.ProduceMaterialExitDetail>; if (list == null || list.Count == 0) { return; } //Model.Depot depot = list[e.ListSourceRowIndex].Depot; //string depotPosition = list[e.ListSourceRowIndex].DepotPosition; Model.Product product = list[e.ListSourceRowIndex].Product; //string productUnit = list[e.ListSourceRowIndex].ProductUnit; switch (e.Column.Name) { //case "gridColumnDepotId": // if (depot != null) // e.DisplayText = string.IsNullOrEmpty(depot.DepotId) ? "" : depot.ToString(); // break; case "gridColumnProductId": if (product != null) { e.DisplayText = string.IsNullOrEmpty(product.ProductId) ? "" : product.ToString(); } break; case "gridColumnProductName": if (product != null) { e.DisplayText = string.IsNullOrEmpty(product.ProductId) ? "" : product.Id; } break; } }