📄 dispone.aspx.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 OI.DatabaseOper ;
namespace OI.IndividualArrange
{
/// <summary>
/// dispOne 的摘要说明。
/// </summary>
public class dispOne : OI.PageBase
{
protected System.Web.UI.WebControls.Label title;
protected System.Web.UI.WebControls.Label beginDate;
protected System.Web.UI.WebControls.Label endDate;
protected System.Web.UI.WebControls.Label content;
private DatabaseConnect dc;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (Session["userid"]==null)
{
Response.Write ("<script>alert('超时,请重新登录');top.location.href='../userpass.aspx';</script>");
return ;
}
dc=new DatabaseConnect ();
if(!this.IsPostBack )
{
this.BindData ();
}
}
private void BindData()
{
int nPlan;
try
{
nPlan=int.Parse ( Request.Params ["id"].Trim ());
}
catch
{
Page.RegisterStartupScript ("","<script>alert(\"输入错误\")</script>");
return;
}
string sql="select title,content,BeginDate,endDate from SelfPlan where PlanId='"+nPlan+"'";
ArrayList al=dc.getData (sql);
if(al.Count >0)
{
title.Text =al[0].ToString ();
content.Text =al[1].ToString ().Replace ("\r\n","<br>");
DateTime dt=DateTime.Parse (al[2].ToString ());
beginDate.Text =dt.Year +"年"+dt.Month +"月"+dt.Day +"日";
dt=DateTime.Parse (al[3].ToString ());
endDate.Text =dt.Year +"年"+dt.Month +"月"+dt.Day +"日";
}
else
Page.RegisterStartupScript ("","<script>alert(\"没有数据\")</script>");
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -