protected void btn_undoClickEvent(object sender, EventArgs e) { if (Session["recentAddedCompany"] != null) { var recentCompanies = Session["recentAddedCompany"] as List <DeltoneCRM_DAL.CompanyDAL.CompanyView>; var comDal = new CompanyDAL(CONNSTRING); var repId = Convert.ToInt32(RepNameDropDownList.SelectedValue); comDal.DeleteLeadRecentCompanies(recentCompanies, repId); Session["recentAddedCompany"] = null; undoButton.Visible = false; messagelable.Text = "Successfully Deleted."; } }