您目前尚未登陆,请选择【登陆】或【注册
首页->其他源码->内文广告管理系统V1.1版源码>>admin1.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:内文广告管理系统V1.1版源码
当前文件:文件类型 TextAd/admin1.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11public partial class admin1 : System.Web.UI.Page 12{ 13 //该源 码下 载自www.51aspx.com(51aspx.com) 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 //没有登录,则转向登录 17 if (Session["admin"]==null||Session["admin"].ToString() != "true") Response.Redirect("login.aspx"); 18 if (!IsPostBack) 19 { 20 myDataBind();//绑定数据 21 } 22 } 23 //分页 24 protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) 25 { 26 GridView1.PageIndex = e.NewPageIndex; 27 myDataBind(); 28 } 29 //删除 30 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) 31 { 32 if (e.CommandName == "del") 33 { 34 string id = e.CommandArgument.ToString(); 35 try 36 { 37 Sql s = new Sql(); 38 s.ExecuteSql("delete from keyarray where id=" + id);//删除 39 myDataBind(); 40 } 41 catch 42 { } 43 } 44 } 45 //绑定数据源 46 private void myDataBind() 47 { 48 Sql s = new Sql(); 49 DataSet ds = s.getMyDataSet("select * from keyarray order by id desc"); 50 GridView1.DataSource = ds; 51 GridView1.DataBind(); 52 } 53 //添加广告关键字 54 protected void Button1_Click(object sender, EventArgs e) 55 { 56 int result; 57 Sql s = new Sql(); 58 //添加关键字 59 result = s.ExecuteSql("insert into keyarray([name],notes) values('"+TextBox1.Text+"','"+ TextBox2.Text+"')"); 60 string msg = "alert('操作错误!')"; 61 if (result==1)//如果操作成功,提示 62 { 63 TextBox2.Text = TextBox1.Text = ""; 64 msg = "alert('操作成功!')"; 65 myDataBind(); 66 } 67 //客户端提示 68 ClientScript.RegisterStartupScript(this.GetType(), "asdf", msg, true); 69 } 70} 71
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:内文广告管理系统V1.1版源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号