您目前尚未登陆,请选择【登陆】或【注册
首页->留言本类->太糊留言板(VS2008+SQL2005)>>Default.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:太糊留言板(VS2008+SQL2005)
当前文件:文件类型 TaiHuMessage/Default.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Configuration; 3using System.Data; 4using System.Data.SqlClient; 5using System.Linq; 6using System.Web; 7using System.Web.Security; 8using System.Web.UI; 9using System.Web.UI.HtmlControls; 10using System.Web.UI.WebControls; 11using System.Web.UI.WebControls.WebParts; 12using System.Xml.Linq; 13 14 15 16public partial class _Default : System.Web.UI.Page 17{ 18 DB DBManage = new DB(); 19 ShowMes sm = new ShowMes(); 20 Timer t = new Timer(); 21 22 protected void Page_Load(object sender, EventArgs e) 23 { 24 if (!IsPostBack) 25 { 26 27 t.Enabled = true; 28 this.time.Text = System.DateTime.Now.ToString(); 29 30 Random rd = new Random(); 31 string rand = Convert.ToString(rd.Next(10000, 99999)); 32 this.Validator.Text = rand; 33 this.Label1.Text=Application ["online"].ToString()+"\t人"; 34 this.Label2.Text = Application["total"].ToString() + "\t人"; 35 } 36 } 37 protected void SubmitLinkButton_Click(object sender, EventArgs e) 38 { 39 40 if (this.ValidatorTextBox.Text.Equals( this.Validator.Text)) 41 { 42 this.RequiredFieldValidator3.IsValid = true; 43 } 44 else 45 { 46 this.RequiredFieldValidator3.IsValid = false; 47 } 48 49 50 string name = this.NameTextBox.Text; 51 string content = this.MessageTextBox.Text; 52 string SqlStr="insert into mes(name,content)values('"+name+"','"+content+"')"; 53 int n; 54 if (this.RequiredFieldValidator1.IsValid == true && this.RequiredFieldValidator2.IsValid == true && this.RequiredFieldValidator3.IsValid == true) 55 { 56 n = DBManage.Command(SqlStr); 57 if (n > 0) 58 { 59 Response.Redirect("ShowResult.aspx?sendmes=恭喜,留言成功!"); 60 61 } 62 } 63 this.NameTextBox.Text = ""; 64 this.MessageTextBox.Text = ""; 65 this.ValidatorTextBox.Text = ""; 66 67 68 69 } 70 71 72 73 74 75 76 77 protected void ClearLinkButton_Click(object sender, EventArgs e) 78 { 79 this.NameTextBox.Text = ""; 80 this.MessageTextBox.Text = ""; 81 this.ValidatorTextBox .Text = ""; 82 } 83} 84
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:太糊留言板(VS2008+SQL2005)
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号