protected void Page_Load(object sender, EventArgs e) { if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } DAL.CMS.CategoryDAL dal = new DAL.CMS.CategoryDAL(); switch (strAction) { case "del": if (dal.UpdateCategoryState(strID)) { strMessage = "删除文章类别完成!"; } else { strMessage = "删除文章类别失败!"; } break; default: break; } Response.Write(strMessage); Response.End(); }
/// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Session["strSiteCode"].ToString()) && Session["strRoleCode"].ToString() != "ADMIN") { Response.Write("<script language=JavaScript>parent.location.href='../Index.aspx';</script>"); Response.End(); } if (!IsPostBack) { #region 初始化界面 this.ddlCategory.Items.Clear(); DAL.CMS.CategoryDAL dal = new DAL.CMS.CategoryDAL(); DataSet ds = new DataSet(); if (GlobalSession.strRoleCode == "ADMIN") { ds = dal.GetAllCategory(""); } else { ds = dal.GetAllCategory(" SiteCode ='" + Session["strSiteCode"].ToString() + "' "); } DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = "0"; dr["Name"] = ""; dt.Rows.InsertAt(dr, 0); this.ddlCategory.DataSource = ds.Tables[0].DefaultView; this.ddlCategory.DataTextField = "Name"; this.ddlCategory.DataValueField = "ID"; this.ddlCategory.DataBind(); if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } ShowArticleInfo(strID); #endregion } }