protected void ddlworkorders_SelectedIndexChanged(object sender, EventArgs e) { whitfield_reports _wr = new whitfield_reports(); DataSet dsNormal = new DataSet(); DataSet dsBudget = new DataSet(); dsNormal = _wr.GetBudgetHoursForWO(ViewState["EstNum"].ToString(), ddlworkorders.SelectedItem.Value); dsBudget = _wr.GetHoursTDForWO(ViewState["EstNum"].ToString(), ddlworkorders.SelectedItem.Value); DataSet dsCummTD = new DataSet(); DataSet dsCummBudget = new DataSet(); dsCummBudget = _wr.GetCummulativeBudgetHoursForWO(txtReportDate.Text.Trim()); dsCummTD = _wr.GetCummulativeHoursTDForWO(txtReportDate.Text.Trim()); lblinstbud.Text = "0"; lblInstbudTD.Text = "0"; lblInstdiffbud.Text = "0"; lblCummHoursTD.Text = "0"; lblCummBudgetHours.Text = "0"; lblCummDiffTD.Text = "0"; DataTable dtNormal = dsNormal.Tables[0]; foreach (DataRow dRow in dtNormal.Rows) { lblinstbud.Text = dRow["install_hours"] == DBNull.Value ? "0" : dRow["install_hours"].ToString(); } DataTable dtTD = dsBudget.Tables[0]; foreach (DataRow dRow1 in dtTD.Rows) { lblInstbudTD.Text = dRow1["install_hours"] == DBNull.Value ? "0" : dRow1["install_hours"].ToString(); } //cumulative Daily Hours DataTable dtCummBudget = dsCummBudget.Tables[0]; foreach (DataRow dRow1 in dtCummBudget.Rows) { lblCummBudgetHours.Text = dRow1["install_hours"] == DBNull.Value ? "0" : dRow1["install_hours"].ToString(); } //dumulative Daily Hours DataTable dtCummTD = dsCummTD.Tables[0]; foreach (DataRow dRow2 in dtCummTD.Rows) { lblCummHoursTD.Text = dRow2["install_hours"] == DBNull.Value ? "0" : dRow2["install_hours"].ToString(); } txtHours.Text = txtHours.Text.Trim() == "" ? "0" : txtHours.Text.Trim().ToString(); lblInstdiffbud.Text = (Convert.ToDecimal(lblinstbud.Text) - (Convert.ToDecimal(txtHours.Text) + Convert.ToDecimal(lblInstbudTD.Text))).ToString(); lblCummDiffTD.Text = (Convert.ToDecimal(lblCummBudgetHours.Text) - Convert.ToDecimal(lblCummHoursTD.Text)).ToString(); }