private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.StockEditor> details = this.bindingSource1.DataSource as IList <Model.StockEditor>; if (details == null || details.Count < 1) { return; } string productCategoryId = details[e.ListSourceRowIndex].ProductCategoryId; Model.ProductCategory productCategory = new Book.BL.ProductCategoryManager().Get(productCategoryId); if (productCategory == null) { return; } switch (e.Column.Name) { case "ProductCategoryId": e.DisplayText = productCategory.ProductCategoryName; break; } }
public void MyLeave(ref ChooseItem item) { BL.ProductCategoryManager manager = new Book.BL.ProductCategoryManager(); Model.ProductCategory productCaregory = manager.GetById(item.ButtonText); if (productCaregory != null) { item.EditValue = productCaregory; item.LabelText = productCaregory.ProductCategoryName; item.ButtonText = productCaregory.Id; } }