addback.aspx.cs
来自「三层班级留言本源码 用VS2005写的,对于其中没有太多的技术含量, 但是」· CS 代码 · 共 70 行
CS
70 行
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;
using UserInfoLib;
//该源码下载自www.51aspx.com(51aspx.com)
public partial class AddBack : System.Web.UI.Page
{
private void Clea()
{
this.TextBox1.Text = "";
Session.Remove("TextID");
this.Response.Write("<script>window.setTimeout('window.close()',0);</script>");
}
private void InsertBack()
{
UserInfo user = new UserInfo();
user.TextID = int.Parse(Session["TextID"].ToString());
user.BackBody = this.TextBox1.Text;
user.UserName = Session["User"].ToString();
if (this.TextBox1.Text!=null && this.TextBox1.Text!="")
{
if (user.InsertBack() == 2)
{
this.Response.Write("<script>alert('回复成功!');</script>");
}
else
this.Response.Write("<script>alert('出现未知错误,无法回复!');</script>");
}
else
{
this.Response.Write("<script>alert('出现未知错误,无法回复!');</script>");
}
Clea();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if ((Session["User"] != null) && (Session["Root"] != null) && (Session["Root"].ToString()) != "0")
{
this.Label1.Text = Session["User"].ToString();
this.Button2.Attributes.Add("onclick", "window.close();");
}
else
{
this.Response.Write("<script>window.setTimeout('window.close()',1000);</script>");
this.Response.Redirect("index.aspx");
//this.Page.RegisterStartupScript("closewindow", "<script>window.close()</script>");
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
InsertBack();
Clea();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?