protected void addextraday_Click(object sender, EventArgs e) { List <string> user_name_list = new List <string>(); foreach (GridViewRow row in GridView1.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox chkRow = (row.Cells[2].FindControl("chkRow") as CheckBox); if (chkRow.Checked) { user_name_list.Add(row.Cells[3].Text); chkRow.Checked = false; } } } int addnumber = Convert.ToInt16(TextBoxAdddays.Text); string reasonText = TextBoxReason.Text; if (user_name_list.Count > 0 && addnumber != 0 && reasonText.Length > 0) { PolaczenieSQL.addextraday(user_name_list, addnumber); PolaczenieSQL.addHRhistory(user_name_list, addnumber, reasonText, Context.User.Identity.Name, "Addtional days"); Response.Redirect("manageusers.aspx"); } }