list.aspx.cs
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:3k
源码类别:

Email客户端

开发平台:

Visual C++

  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. public partial class manage_list : System.Web.UI.Page
  12. {
  13.     BaseClass bc = new BaseClass();
  14.     static string strStyle;
  15.     static int pagecount = 0;
  16.     protected void Page_Load(object sender, EventArgs e)
  17.     {
  18.         //if (!IsPostBack)
  19.         //{
  20.             int n = Convert.ToInt16(Request.QueryString["id"]);
  21.             switch (n)
  22.             {
  23.                 case 1: strStyle = "style='时政要闻'";
  24.                     break;
  25.                 case 2: strStyle = "style='经济动向'";
  26.                     break;
  27.                 case 3: strStyle = "style='世界军事'";
  28.                     break;
  29.                 case 4: strStyle = "style='科学教育'";
  30.                     break;
  31.                 case 5: strStyle = "style='法治道德'";
  32.                     break;
  33.                 case 6: strStyle = "style='社会现象'";
  34.                     break;
  35.                 case 7: strStyle = "style='体育世界'";
  36.                     break;
  37.                 case 8: strStyle = "style='时尚娱乐'";
  38.                     break;
  39.                 default: strStyle = "style like '%%'";
  40.                     break;
  41.             }
  42.             GridView1.DataSource = bc.GetDataSet("select * from tbNews where " + strStyle + "order by id", "tbNews");
  43.             GridView1.DataKeyNames = new string[] { "id" };
  44.             GridView1.DataBind();
  45.         //}
  46.     }
  47.     protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
  48.     {
  49.         bc.ExecSQL("delete  from tbNews where id='" + this.GridView1.DataKeys[e.RowIndex].Value.ToString() + "'");
  50.         GridView1.DataSource = bc.GetDataSet("select * from tbNews where " + strStyle, "tbNews");
  51.         GridView1.DataBind();
  52.     }
  53.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  54.     {
  55.         GridView1.PageIndex = e.NewPageIndex;
  56.         GridView1.DataBind();
  57.     }
  58.     protected void cmdSearch_Click(object sender, EventArgs e)
  59.     {
  60.         string strSql = "select * from tbnews where style='" + DropDownList1.Text + "' and content like '%" + TextBox1.Text + "%'";
  61.         GridView1.DataSource = bc.GetDataSet(strSql, "tbNews");
  62.         GridView1.DataKeyNames = new string[] { "id" };
  63.         GridView1.DataBind();
  64.     }
  65.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  66.     {
  67.         if (e.Row.RowType == DataControlRowType.DataRow)
  68.         {
  69.             e.Row.Cells[3].Text =Convert.ToDateTime(e.Row.Cells[3].Text).ToShortDateString();
  70.         }
  71.     }
  72. }