messagelist.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_messagelist : 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 = Messages.QueryMessages();
  21.         GV.DataSource = ds;
  22.         GV.DataBind();
  23.     }
  24.     protected void GV_PageIndexChanging(object sender, GridViewPageEventArgs e)
  25.     {
  26.         GV.PageIndex = e.NewPageIndex;
  27.         InitData();
  28.     }
  29.     protected void GV_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(GV.Rows[index].Cells[0].Text);
  38.                 Messages messages = new Messages();
  39.                 messages.LoadData(id);
  40.                 messages.Delete();
  41.                 Response.Write("<Script Language=JavaScript>alert('删除成功!');</Script>");
  42.                 InitData();
  43.                 break;
  44.             default:
  45.                 break;
  46.         }
  47.     }
  48.     protected void GV_RowDeleting(object sender, GridViewDeleteEventArgs e)
  49.     {
  50.         ;
  51.     }
  52. }