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

📄 st_courseadd.aspx.cs

📁 数据库:Microsoft SQL Server 2000。 技术平台:Microsoft .NET Framework 2.0.0.0版本。 IIS:Internet Informati
💻 CS
字号:
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;
using STGROUP.ST_ExamBiz;

namespace STGROUP.ST_WebExam.ST_Admin
{
	/// <summary>
	/// ST_CourseAdd 的摘要说明。
	/// </summary>
	public partial class ST_CourseAdd : System.Web.UI.Page
	{
	
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			Response.Cache.SetCacheability(HttpCacheability.NoCache);
			if(!IsPostBack)
			{
				ST_ExamBiz.ST_Course st_Course = new STGROUP.ST_ExamBiz.ST_Course();//去掉页面缓存
				if(Request["Action"]=="edit" && Request["id"]!=null)
				{
					DataSet ds = st_Course.ST_GetCourseInfo(int.Parse(Request["id"]));
					txtNumber.Text = ds.Tables[0].Rows[0]["ST_CourseID"].ToString();
					txtName.Text = ds.Tables[0].Rows[0]["ST_CourseName"].ToString();
				}
			}
		}

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

		}
		#endregion

		protected void btnOK_Click(object sender, System.EventArgs e)
		{
			//判断条件,名称不允许未空,名称长度不超过20个字符
			if(txtName.Text=="")
				Response.Write("<script defer>alert('名称不允许未空');</script>");
			else if(txtName.Text.Length>20)
			{
				Response.Write("<script defer>alert('最多20个字符');</script>");
			}
			else
			{
				ST_ExamBiz.ST_Course st_Course = new STGROUP.ST_ExamBiz.ST_Course();
				if(Request["Action"]=="add")//插入科目信息
					st_Course.ST_InsertCourseInfo(txtName.Text.Trim());
				else//更新科目信息
					st_Course.ST_UpdateCourseInfo(txtName.Text.Trim(), int.Parse(txtNumber.Text));

				string str = "<script language=javascript>window.dialogArguments.document.location.href='ST_Course.aspx';window.close();</script>"; 
				Response.Write(str);
			}
		}
	}
}

⌨️ 快捷键说明

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