/// <summary> /// The DeleteBtn_Click server event handler is used to delete /// the selected tab from the portal /// </summary> protected void DeleteBtn_Click(object sender, ImageClickEventArgs e) { //base.OnDelete(); if (tabList.SelectedIndex > -1) { try { // must delete from database too PageItem t = ( PageItem )portalPages[tabList.SelectedIndex]; PagesDB tabs = new PagesDB(); tabs.DeletePage(t.ID); portalPages.RemoveAt(tabList.SelectedIndex); if (tabList.SelectedIndex > 0) { t = ( PageItem )portalPages[tabList.SelectedIndex - 1]; } OrderPages(); Response.Redirect(HttpUrlBuilder.BuildUrl("~/DesktopDefault.aspx", PageID, "SelectedPageID=" + t.ID)); } catch (SqlException) { Controls.Add( new LiteralControl("<br><span class='Error'>" + General.GetString("TAB_DELETE_FAILED", "Failed to delete Page", this) + "<br>")); } } }
public JsonResult remove(int id) { try { var tabs = new PagesDB(); tabs.DeletePage(id); return(Json(new { error = false })); } catch (SqlException) { string errorMessage = General.GetString("TAB_DELETE_FAILED", "Failed to delete Page", this); return(Json(new { error = true, errorMess = errorMessage })); } }
/// <summary> /// Handles OnDelete /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected override void OnDelete(EventArgs e) { base.OnDelete(e); if (this._moduleID > 0) { ModulesDB modules = new ModulesDB(); // TODO add userEmail and useRecycler modules.DeleteModule(_moduleID); _moduleID = 0; } if (this._pageID > 0) { var tabs = new PagesDB(); tabs.DeletePage(this._pageID); } RedirectBackToReferringPage(); }