protected void btnSave_Click(object sender, EventArgs e) { EmpLeaveBalance _dalEmpLeaveBalance = null; Hashtable _htParameters = null; int iNextID = 0; try { foreach (GridViewRow row in gvwList.Rows) { if (row.RowType == DataControlRowType.DataRow) { string p_Employee_Code = row.Cells[1].Text; string p_ID = (row.Cells[3].FindControl("lblID") as Label).Text; string p_Quota = (row.Cells[4].FindControl("txtQuota") as TextBox).Text; string p_Used = (row.Cells[5].FindControl("txtUsed") as TextBox).Text; string p_Balance = (row.Cells[6].FindControl("txtBalance") as TextBox).Text; _dalEmpLeaveBalance = new EmpLeaveBalance(); _htParameters = new Hashtable(); _htParameters["p_Employee_Code"] = p_Employee_Code; _htParameters["p_Year"] = ddlYear.SelectedValue; //_htParameters["p_Quota"] = Convert.ToDecimal(string.IsNullOrEmpty(p_Quota) ? "0" : p_Quota); //_htParameters["p_Used"] = Convert.ToDecimal(string.IsNullOrEmpty(p_Used) ? "0" : p_Used); //_htParameters["p_Balance"] = Convert.ToDecimal(string.IsNullOrEmpty(p_Balance) ? "0" : p_Balance); _htParameters["p_Quota"] = double.Parse(string.IsNullOrEmpty(p_Quota) ? "0" : p_Quota); _htParameters["p_Used"] = double.Parse(string.IsNullOrEmpty(p_Used) ? "0" : p_Used); _htParameters["p_Balance"] = double.Parse(string.IsNullOrEmpty(p_Balance) ? "0" : p_Balance); if (p_ID == "") { Utility.ApplyDefaultProp(_htParameters); _dalEmpLeaveBalance.Insert(_htParameters, ref iNextID); } else { _htParameters["p_ID"] = p_ID; Utility.ApplyDefaultProp(_htParameters); _dalEmpLeaveBalance.Update(_htParameters); //iNextID = Int32.Parse(lblEmployee_ID.Text); } } } } catch (Exception ex) { Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null); } //Response.Redirect("lstblbranchdetail.aspx?action=add"); }