protected void gvExpense_RowDataBound(object sender, GridViewRowEventArgs e) { // 对数据列进行赋值 if (e.Row.RowType == DataControlRowType.DataRow) { ERS.ExpenseItemRow itemRow = null; if ((e.Row.RowState & DataControlRowState.Edit) != DataControlRowState.Edit) { DataRowView drvDetail = (DataRowView)e.Row.DataItem; FormDS.FormApplyExpenseDetailRow row = (FormDS.FormApplyExpenseDetailRow)drvDetail.Row; manualApplyFeeTotal = decimal.Round((manualApplyFeeTotal + row.Amount), 2); this.ViewState["ManualApplyFeeTotal"] = manualApplyFeeTotal; itemRow = new MasterDataBLL().GetExpenseItemByID(row.ExpenseItemID); if (itemRow.IsInContract) { inContractAmount = decimal.Round((inContractAmount + row.Amount), 2); } } } this.ViewState["InContractAmount"] = inContractAmount; }
protected void gvApplyDetails_RowDataBound(object sender, GridViewRowEventArgs e) { // 对数据列进行赋值 if (e.Row.RowType == DataControlRowType.DataRow) { ERS.ExpenseItemRow itemRow = null; if ((e.Row.RowState & DataControlRowState.Edit) != DataControlRowState.Edit) { DataRowView drvDetail = (DataRowView)e.Row.DataItem; FormDS.FormApplyDetailViewRow row = (FormDS.FormApplyDetailViewRow)drvDetail.Row; manualApplyFeeTotal = decimal.Round((manualApplyFeeTotal + row.Amount), 2); itemRow = new MasterDataBLL().GetExpenseItemByID(row.ExpenseItemID); if (itemRow.IsInContract) { inContractAmount = decimal.Round((inContractAmount + row.Amount), 2); } } } this.ViewState["ManualApplyFeeTotal"] = manualApplyFeeTotal; this.ViewState["InContractAmount"] = inContractAmount; if (e.Row.RowType == DataControlRowType.Footer) { Label sumlbl = new Label(); sumlbl.Text = "合计:"; e.Row.Cells[1].Controls.Add(sumlbl); e.Row.Cells[1].CssClass = "RedTextAlignCenter"; e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Center; e.Row.Cells[1].Width = new Unit("250px"); Label totallbl = new Label(); totallbl.Text = manualApplyFeeTotal.ToString("N"); e.Row.Cells[2].Controls.Add(totallbl); e.Row.Cells[2].CssClass = "RedTextAlignCenter"; e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Right; e.Row.Cells[2].Width = new Unit("100px"); } }