/// <summary> /// delete item(s) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Delete_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure to delete the record?", "Dialog", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { LeaveDetailsService service = new LeaveDetailsService(); for (int i = 0; i < RequestHistory.Rows.Count;) { if (Convert.ToBoolean(RequestHistory.Rows[i].Cells[0].Value) == true) { LeaveDetails detail = new LeaveDetails(); detail = detailsBindingList.ElementAt(i); detailsBindingList.RemoveAt(i); service.RemoveDetails(detail); } else { i++; } } RequestHistory.DataSource = null; allDetails.Clear(); detailsBindingList.Clear(); AssignDatatoList(); AddLeavingsAttributetoList(allDetails); BindVactionDetails(); nCurrent = 0; pageCurrent = 0; InitPagingList(); MessageBox.Show("Submit Successfully !"); } }