protected void gvxPaymentClinics_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e) { if (e.Column.FieldName == "Total Required") { PaymentRepository paymentRepository = new PaymentRepository(); e.Value = paymentRepository.GetAllCostTreatmentByClinic(int.Parse(e.GetListSourceFieldValue("ClinicID").ToString())); } else if (e.Column.FieldName == "Total Payed") { PaymentRepository paymentRepository = new PaymentRepository(); e.Value = paymentRepository.GetAllPayedReceitsByClinic(int.Parse(e.GetListSourceFieldValue("ClinicID").ToString())); } else if (e.Column.FieldName == "Total Deserved") { e.Value = decimal.Parse(e.GetListSourceFieldValue("Total Required").ToString()) - decimal.Parse(e.GetListSourceFieldValue("Total Payed").ToString()); } }