Article.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_Article : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         InitData();
  17.     }
  18.     public void InitData()
  19.     {
  20.         DataSet ds = Article.QueryArticles();
  21.         ArtGV.DataSource = ds.Tables[0];
  22.         ArtGV.DataBind();
  23.         Label1.Text = (ArtGV.PageCount * ArtGV.PageSize).ToString();
  24.         Label2.Text =(ArtGV.PageIndex + 1).ToString();
  25.         Label3.Text = ArtGV.PageCount.ToString();
  26.     }
  27.     protected void ArtGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
  28.     {
  29.         ArtGV.PageIndex = e.NewPageIndex;
  30.         InitData();
  31.     }
  32.     protected void ArtGV_RowCommand(object sender, GridViewCommandEventArgs e)
  33.     {
  34.         int index = Convert.ToInt32(e.CommandArgument); //待处理的行下标
  35.         int id = -1;
  36.         switch (e.CommandName)
  37.         {
  38.             //删除
  39.             case "Delete":
  40.                 id = Convert.ToInt32(ArtGV.Rows[index].Cells[0].Text);
  41.                 Article articles = new Article();
  42.                 articles.LoadData(id);
  43.                 articles.Delete();
  44.                 Response.Write("<Script Language=JavaScript>alert('删除成功!');</Script>");
  45.                 InitData();
  46.                 break;
  47.             default:
  48.                 break;
  49.         }
  50.     }
  51.     protected void ArtGV_RowDeleting(object sender, GridViewDeleteEventArgs e)
  52.     {
  53.         ;
  54.     }
  55. }