【发布时间】:2013-11-22 12:15:25
【问题描述】:
我的代码是这样的
private MyCatch _catch = new MyCatch("Description");
decimal getTotalValue(GridView view, int listSourceRowIndex)
{
decimal unitPrice = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "Each")); //Object cannot be cast from DBNull to other types
decimal quantity = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "Quantity"));
decimal discount = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "TaxPercentage"));
return unitPrice * quantity * (1 - discount);
}
private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
{
GridView view = sender as GridView;
if (e.Column.FieldName == "Totalototal" && e.IsGetData) e.Value =
getTotalValue(view, e.ListSourceRowIndex);
}
【问题讨论】:
标签: c# winforms devexpress