温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:网博直销系统软件源码
当前文件:
WangBoDirect/admin/webhww_gg.aspx.cs,打开代码结构图
WangBoDirect/admin/webhww_gg.aspx.cs,打开代码结构图1using 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
12
public partial class admin_webhww_gg : System.Web.UI.Page 13
{ 14
protected void Page_Load(object sender, EventArgs e) 15
{ 16
if (Session["aid"] == null) 17
{ Response.Write("<script language=javascript>top.location.href='login.aspx';alert('您未登录!');</script>"); } 18
else 19
{ 20
if (!IsPostBack) 21
{ 22
bind(); 23
if (Request.QueryString["sid"] != null) 24
{ 25
delete(); 26
} 27
if (Request.QueryString["bid"] != null) 28
{ 29
updata(); 30
Button1.Text = "修改"; 31
} 32
} 33
} 34
} 35
void delete() 36
{ 37
access.DoSql("delete * from webhww_gonggao where id="+Request.QueryString["sid"]+""); 38
bind(); 39
} 40
void updata() 41
{ 42
string sql = "select * from webhww_gonggao where id="+Request.QueryString["bid"]+" order by id desc"; 43
DataTable dt = new DataTable(); 44
dt = access.GreatDs(sql).Tables[0]; 45
TextBox1.Text = dt.Rows[0]["webhww_biaoti"].ToString(); 46
txtcontent.Value = dt.Rows[0]["webhww_neirong"].ToString(); 47
} 48
void bind() 49
{ 50
string sql = "select * from webhww_gonggao order by id desc"; 51
GridView1.DataSource = access.GreatDs(sql); 52
GridView1.DataBind(); 53
} 54
protected void Button1_Click(object sender, EventArgs e) 55
{ 56
string sql = ""; 57
string _webhww_biaoti = re.replace(TextBox1.Text); 58
string _webhww_neirong = re.replace(txtcontent.Value); 59
if (Request.QueryString["bid"] != null) 60
{ 61
sql = "update webhww_gonggao set webhww_biaoti='" + _webhww_biaoti + "',webhww_neirong='" + _webhww_neirong + "' where id="+Request.QueryString["bid"]+""; 62
63
} 64
else 65
{ 66
sql = "insert into webhww_gonggao(webhww_biaoti,webhww_neirong,webhww_shijian) values ('" + _webhww_biaoti + "','" + _webhww_neirong + "','" + DateTime.Now + "')"; 67
} 68
access.DoSql(sql); 69
bind(); 70
} 71
} 72





}
}