⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editthread.aspx.cs

📁 This is not a very mean things
💻 CS
字号:
//***********************************************************************
//
// WebExpert.NET 1.0 
//
// (c) 2003, www.AspCool.com. All rights reserved.
// ASP酷技术网版权所有
//
// 该源码下载自:http://www.51aspx.com
// 邮箱:tim@aspcool.com
//
// 版权声明:本程序仅供学习使用,你也可以修改后在网站上使用,但使用时必
// 须保留ASP酷技术网(www.AspCool.com)的版权信息和链接。本程序随《ASP.NET
// 网站建设专家》一书赠送,未经作者同意,不得随意修改、传播。
//
// 描述:
//   此文件包含下面的类:
//       EditThread
//
// 作者:     王保健
// 时间:     2004/12/15
//
//************************************************************************

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace AspCool.WebExpert.bbs
{
	/// <summary>
	/// EditThread 的摘要说明。
	/// </summary>
	public class EditThread : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
		protected System.Web.UI.WebControls.TextBox Content;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
		protected System.Web.UI.WebControls.LinkButton UpdateButton;
		protected System.Web.UI.WebControls.LinkButton CancelButton;
		protected System.Web.UI.WebControls.TextBox Subject;
		protected System.Web.UI.WebControls.LinkButton DeleteButton;

		int itemId = 0;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			if (Session["UserName"] == null)
			{
				Response.Redirect(Request.ApplicationPath + "/Users/UserLogin.aspx?returnURL=" + Request.Url.ToString());
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
			this.CancelButton.Click += new System.EventHandler(this.CancelButton_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void UpdateButton_Click(object sender, System.EventArgs e)
		{
			// Only Update if the Entered Data is Valid
			if (Page.IsValid == true) 
			{
				if (Session["UserName"] == null)
				{
					Response.Redirect(Request.ApplicationPath + "/Users/UserLogin.aspx?returnURL=" + Request.Url.ToString());
				}

				if (Request.Params["ItemId"] != null) 
				{
					itemId = Int32.Parse(Request.Params["ItemId"]);
				}

				// Create an instance of the news DB component
				ThreadsDB thread = new ThreadsDB();

				if (itemId == 0) 
				{

					// Add the thread within the threads table
					thread.AddThread(itemId,Session["UserName"].ToString(),Subject.Text ,Content.Text,0,0);
				}
				// Redirect back to the portal home page
				Response.Redirect("ShowThread.aspx");
			}
		}

		private void CancelButton_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("ShowThread.aspx");		
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -