ArticleClass.aspx.cs
上传用户:szraylite
上传日期:2018-06-06
资源大小:11546k
文件大小:2k
源码类别:

软件测试

开发平台:

Java

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using ENTERPRISE.BusinessLogicLayer;
  12. public partial class admin_ArticleClass : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         InitData();
  17.     }
  18.     private void InitData()
  19.     {
  20.         DataSet ds = ArticleClass.Queryclass();
  21.         ClassGV.DataSource = ds;
  22.         ClassGV.DataBind();
  23.     }
  24.     protected void ClassGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
  25.     {
  26.         ClassGV.PageIndex = e.NewPageIndex;
  27.         InitData();
  28.     }
  29.     protected void ClassGV_RowCommand(object sender, GridViewCommandEventArgs e)
  30.     {
  31.         int index = Convert.ToInt32(e.CommandArgument); //待处理的行下标
  32.         int id = -1;
  33.         switch (e.CommandName)
  34.         {
  35.             //删除
  36.             case "Delete":
  37.                 id = Convert.ToInt32(ClassGV.Rows[index].Cells[0].Text);
  38.                 ArticleClass articleClass = new ArticleClass();
  39.                 articleClass.LoadData(id);
  40.                 articleClass.Delete();
  41.                 Response.Write("<Script Language=JavaScript>alert('删除成功!');</Script>");
  42.                 InitData();
  43.                 break;
  44.             default:
  45.                 break;
  46.         }
  47.     }
  48.     protected void ClassGV_RowDeleting(object sender, GridViewDeleteEventArgs e)
  49.     {
  50.         ;
  51.     }
  52. }