Пример #1
0
 protected void dataListInfo_DeleteCommand(object source, DataListCommandEventArgs e)
 {
     if (Session["Role"] != null)
     {
         if (Session["Role"].ToString() == "0" || Session["Role"].ToString() == "2")
         {
             int PostID = Convert.ToInt32(dataListInfo.DataKeys[e.Item.ItemIndex].ToString());//获取当前DataList控件列
             if (postBll.DelPost(PostID))
             {
                 Response.Write("<script>alert('删除成功!')</script>");
                 labPage.Text = "1";
                 this.DataListBd();
             }
             else
             {
                 Response.Redirect("errorPage.aspx");
             }
         }
         else
         {
             Response.Redirect("limitRole.aspx");
         }
     }
     else
     {
         Response.Redirect("limitRole.aspx");
     }
 }