private void DisplaySupportUnit(String supportUnit) { StoredProcedures sp = new StoredProcedures(); DataSet tbl = sp.DisplaySupportUnit2(FinancialYearDropDownList.SelectedValue, supportUnit); SupportUnitPanel.Visible = true; SupportUnitBreakDownGridView.DataSource = tbl; SupportUnitBreakDownGridView.DataBind(); SupportUnitLabel.Text = supportUnit + " Breakdown " + FinancialYearDropDownList.SelectedValue; }
protected void SupportUnitBreakDownGridView_RowDataBound(Object sender, GridViewRowEventArgs e) { String supportUnit = (String)Session["supportUnit"]; StoredProcedures sp = new StoredProcedures(); DataSet ds = sp.DisplaySupportUnit2(FinancialYearDropDownList.SelectedValue, supportUnit); Double total = 0; foreach (DataRow row in ds.Tables[0].Rows) { total = total + Double.Parse(row[4].ToString()); } foreach (GridViewRow row2 in SupportUnitBreakDownGridView.Rows) { LinkButton lb = (LinkButton)row2.Cells[0].Controls[0]; lb.ForeColor = ColorTranslator.FromHtml("#0000EE"); } if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[0].Text = "Total"; e.Row.Cells[3].Text = String.Format("{0:C}", total); } }