KHZL.aspx.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace iNethinkCMS.Web.admin.extend
  8. {
  9. public partial class KHZL : System.Web.UI.Page
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. if (!IsPostBack)
  14. {
  15. Bind();
  16. if (!string.IsNullOrEmpty(Request.QueryString["Delete"]))
  17. {
  18. BLL.BLL_Immediateuse bll = new BLL.BLL_Immediateuse();
  19. string id = Request.QueryString["Delete"];
  20. id = id.Substring(0, id.Length - 1);
  21. if (bll.DeleteList(id))
  22. {
  23. ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type='text/javascript'>alert('删除成功');window.location.replace('KHZL.aspx')</script>");
  24. }
  25. else
  26. {
  27. ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type='text/javascript'>alert('删除成功');</script>");
  28. }
  29. }
  30. }
  31. }
  32. void Bind()
  33. {
  34. BLL.BLL_Immediateuse bll = new BLL.BLL_Immediateuse();
  35. DataTable dt = bll.GetList("1=1").Tables[0];
  36. PagedDataSource pds = new PagedDataSource();
  37. AspNetPager1.RecordCount = dt.Rows.Count;
  38. pds = new PagedDataSource();
  39. pds.AllowPaging = true;
  40. pds.PageSize = AspNetPager1.PageSize;
  41. pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
  42. pds.DataSource = dt.DefaultView;
  43. rptList.DataSource = pds;
  44. rptList.DataBind();
  45. }
  46. protected void AspNetPager1_PageChanged(object sender, EventArgs e)
  47. {
  48. // Bind();
  49. }
  50. }
  51. }