protected void dgSchedule_DeleteCommand(object source, DataGridCommandEventArgs e) { try { DataTable tblCart = ViewState["Cart"] as DataTable; //test = tblCart.Rows[e.Item.ItemIndex].Field<Int64>("JournalDCode").ToString(); using (EmployeeJournalDetails objEmployeeJournalDetails = new EmployeeJournalDetails()) { objEmployeeJournalDetails.EmployeeJournalDetailsCode = Convert.ToInt16(tblCart.Rows[e.Item.ItemIndex].Field <Int64>("JournalDCode")); objEmployeeJournalDetails.IsEnabled = "0"; if (objEmployeeJournalDetails.UpdateEnabled() > 0) { tblCart.Rows[e.Item.ItemIndex].Delete(); ViewState["Cart"] = tblCart; dgSchedule.DataSource = tblCart; dgSchedule.DataBind(); } } } catch { Response.Redirect("JournalEncodingM.aspx?JournalCode=" + ViewState["JournalCode"].ToString()); } }
protected void DeleteJournalDetails(object sender, EventArgs e) { try { DataTable tblCart = ViewState["Cart"] as DataTable; using (EmployeeJournalDetails objEmployeeJournalDetails = new EmployeeJournalDetails()) { LinkButton lnkRemove = (LinkButton)sender; objEmployeeJournalDetails.EmployeeJournalDetailsCode = Convert.ToInt16(lnkRemove.CommandArgument); objEmployeeJournalDetails.IsEnabled = "0"; if (objEmployeeJournalDetails.UpdateEnabled() > 0) { dgSchedule.EditIndex = -1; this.MakeCart(); this.LoadDSLs(); } } } catch { Response.Redirect("JournalEncoding.aspx"); } }