Edit.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_govEdit : System.Web.UI.Page
  12. {
  13.     BaseClass bc = new BaseClass();
  14.     static string strStyle;
  15.     static string strType;
  16.     protected void Page_Load(object sender, EventArgs e)
  17.     {
  18.         if (!IsPostBack)
  19.         {
  20.             DataSet ds = bc.GetDataSet("select * from tbNews where id='" + Request.QueryString["id"] + "'", "tbNews");
  21.             DataRow[] row = ds.Tables[0].Select();
  22.             foreach (DataRow rs in row)
  23.             {
  24.                 
  25.                 TextBox1.Text = rs["title"].ToString();
  26.                 TextBox2.Text = rs["content"].ToString();
  27.                 strStyle = rs["Style"].ToString();
  28.                 strType = rs["type"].ToString();
  29.             }
  30.             switch (strStyle)
  31.             { 
  32.                 case "时政要闻":
  33.                     dlGov.Text = strType;
  34.                     dlGov.Visible = true;
  35.                     Label1.Text = "编辑★★时政要闻★★";
  36.                     break;
  37.                 case "经济动向":
  38.                     dlJj.Text = strType;
  39.                     dlJj.Visible = true;
  40.                     Label1.Text = "编辑★★经济动向★★";
  41.                     break;
  42.                 case "世界军事":
  43.                     dlArmy.Text = strType;
  44.                     dlArmy.Visible = true;
  45.                     Label1.Text = "编辑★★世界军事★★";
  46.                     break;
  47.                 case "科学教育":
  48.                     dlKJ.Text = strType;
  49.                     dlKJ.Visible = true;
  50.                     Label1.Text = "编辑★★科学教育★★";
  51.                     break;
  52.                 case "法治道德":
  53.                     dlFz.Text = strType;
  54.                     dlFz.Visible = true;
  55.                     Label1.Text = "编辑★★法治道德★★";
  56.                     break;
  57.                 case "社会现象":
  58.                     dlSh.Text = strType;
  59.                     dlSh.Visible = true;
  60.                     Label1.Text = "编辑★★社会现象★★";
  61.                     break;
  62.                 case "体育世界":
  63.                     dlTy.Text = strType;
  64.                     dlTy.Visible = true;
  65.                     Label1.Text = "编辑★★体育世界★★";
  66.                     break;
  67.                 case "时尚娱乐":
  68.                     dlSh.Text = strType;
  69.                     dlSh.Visible = true;
  70.                     Label1.Text = "编辑★★时尚娱乐★★";
  71.                     break;
  72.             }
  73.         }
  74.     }
  75.     protected void Button1_Click(object sender, EventArgs e)
  76.     {
  77.         bc.ExecSQL("UPDATE tbNews SET Title = '"+TextBox1.Text+"', Content = '"+TextBox2.Text+"', Style = '"+strStyle+"', Type = '"+strType+"' WHERE (ID = '"+Request.QueryString["id"]+"')");
  78.         Response.Write(bc.MessageBox("数据修改成功!"));
  79.         Response.Write("<script>location='list.aspx'</script>");
  80.     }
  81.     protected void Button2_Click(object sender, EventArgs e)
  82.     {
  83.         TextBox1.Text = "";
  84.         TextBox2.Text = "";
  85.     }
  86. }