protected void btnSelectAll_Click(object sender, EventArgs e) { if (this.btnSelectAll.Text == "Select All") { Bill_Sys_BillTransaction_BO n_bo = new Bill_Sys_BillTransaction_BO(); double num = 0.0; DataSet set = new DataSet(); string str = ""; if (this.Session["OFF_ID"] != null) { str = this.Session["OFF_ID"].ToString(); } set = n_bo.GetBills(this.txtCompanyId.Text, this.txtLoginCompanyId.Text, str, this.txtSearchBox.Text, this.txtFlag.Text); for (int i = 0; i < this.grdBillSearch.Rows.Count; i++) { CheckBox box = (CheckBox)this.grdBillSearch.Rows[i].FindControl("ChkDelete"); box.Checked = true; box.Enabled = false; } for (int j = 0; j < set.Tables[0].Rows.Count; j++) { string str2 = set.Tables[0].Rows[j][5].ToString(); switch (str2) { case "": case null: case " ": str2 = "0"; break; } num += Convert.ToDouble(str2); } this.txtSum.Text = Convert.ToString(num); this.btnSelectAll.Text = "Deselect All"; this.hselectVlaue.Value = "2"; this.Session["SelectAll"] = "TRUE"; } else if (this.btnSelectAll.Text == "Deselect All") { this.Session["SelectAll"] = null; this.hselectVlaue.Value = "1"; this.txtSum.Text = ""; this.btnSelectAll.Text = "Select All"; for (int k = 0; k < this.grdBillSearch.Rows.Count; k++) { CheckBox box2 = (CheckBox)this.grdBillSearch.Rows[k].FindControl("ChkDelete"); box2.Enabled = true; box2.Checked = false; } } }