Article.aspx.cs
资源名称:moban.rar [点击查看]
上传用户:szraylite
上传日期:2018-06-06
资源大小:11546k
文件大小:2k
源码类别:
软件测试
开发平台:
Java
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using ENTERPRISE.BusinessLogicLayer;
- public partial class admin_Article : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- InitData();
- }
- public void InitData()
- {
- DataSet ds = Article.QueryArticles();
- ArtGV.DataSource = ds.Tables[0];
- ArtGV.DataBind();
- Label1.Text = (ArtGV.PageCount * ArtGV.PageSize).ToString();
- Label2.Text =(ArtGV.PageIndex + 1).ToString();
- Label3.Text = ArtGV.PageCount.ToString();
- }
- protected void ArtGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- ArtGV.PageIndex = e.NewPageIndex;
- InitData();
- }
- protected void ArtGV_RowCommand(object sender, GridViewCommandEventArgs e)
- {
- int index = Convert.ToInt32(e.CommandArgument); //待处理的行下标
- int id = -1;
- switch (e.CommandName)
- {
- //删除
- case "Delete":
- id = Convert.ToInt32(ArtGV.Rows[index].Cells[0].Text);
- Article articles = new Article();
- articles.LoadData(id);
- articles.Delete();
- Response.Write("<Script Language=JavaScript>alert('删除成功!');</Script>");
- InitData();
- break;
- default:
- break;
- }
- }
- protected void ArtGV_RowDeleting(object sender, GridViewDeleteEventArgs e)
- {
- ;
- }
- }