protected void btnSave_Click(object sender, EventArgs e) { int TotCount = 0; try { foreach (GridViewRow gRow in grGrossSalary.Rows) { CheckBox chBox = new CheckBox(); chBox = (CheckBox)gRow.Cells[0].FindControl("chkBox"); if (chBox.Checked == true) { TotCount = TotCount + 1; } } objPayrollMgr.InsertGrossSalHead(grGrossSalary, TotCount); Common.EmptyTextBoxValues(this); //this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ""; throw (ex); } }