list.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:3k
源码类别:
Email客户端
开发平台:
Visual C++
- 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;
- public partial class manage_list : System.Web.UI.Page
- {
- BaseClass bc = new BaseClass();
- static string strStyle;
- static int pagecount = 0;
- protected void Page_Load(object sender, EventArgs e)
- {
- //if (!IsPostBack)
- //{
- int n = Convert.ToInt16(Request.QueryString["id"]);
- switch (n)
- {
- case 1: strStyle = "style='时政要闻'";
- break;
- case 2: strStyle = "style='经济动向'";
- break;
- case 3: strStyle = "style='世界军事'";
- break;
- case 4: strStyle = "style='科学教育'";
- break;
- case 5: strStyle = "style='法治道德'";
- break;
- case 6: strStyle = "style='社会现象'";
- break;
- case 7: strStyle = "style='体育世界'";
- break;
- case 8: strStyle = "style='时尚娱乐'";
- break;
- default: strStyle = "style like '%%'";
- break;
- }
- GridView1.DataSource = bc.GetDataSet("select * from tbNews where " + strStyle + "order by id", "tbNews");
- GridView1.DataKeyNames = new string[] { "id" };
- GridView1.DataBind();
- //}
- }
- protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
- {
- bc.ExecSQL("delete from tbNews where id='" + this.GridView1.DataKeys[e.RowIndex].Value.ToString() + "'");
- GridView1.DataSource = bc.GetDataSet("select * from tbNews where " + strStyle, "tbNews");
- GridView1.DataBind();
- }
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- GridView1.PageIndex = e.NewPageIndex;
- GridView1.DataBind();
- }
- protected void cmdSearch_Click(object sender, EventArgs e)
- {
- string strSql = "select * from tbnews where style='" + DropDownList1.Text + "' and content like '%" + TextBox1.Text + "%'";
- GridView1.DataSource = bc.GetDataSet(strSql, "tbNews");
- GridView1.DataKeyNames = new string[] { "id" };
- GridView1.DataBind();
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.Cells[3].Text =Convert.ToDateTime(e.Row.Cells[3].Text).ToShortDateString();
- }
- }
- }