protected void btnDelete_Click(object sender, EventArgs e) { int[] ids = new int[gvCalendar.Rows.Count]; for (int a = 0; a < gvCalendar.Rows.Count; a++) { if ((gvCalendar.Rows[a].FindControl("chkOne") as CheckBox).Checked) { HiddenField hfId = gvCalendar.Rows[a].FindControl("hfOne") as HiddenField; ids[a] = Convert.ToInt32(hfId.Value); } } foreach (int riid in ids) { if (riid != 0) { CalendarManager.DeleteCalendar(riid); } } Pager1_onLoadPageIndexChaning(Pager1.PageIndex); }