📄 admindowntype.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;
namespace _211
{
/// <summary>
/// AdminDownType 的摘要说明。
/// </summary>
public partial class AdminDownType : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
if(Session["name"]==null)
{
Response.Write("<script>top.location='AdminLogin.aspx'</script>");
return;
}
if(!Page.IsPostBack)
{
BindType();
}
Button3.Attributes["onclick"]="return confirm('确定要删除么?')";
}
private void BindType()
{
dt.DataSource=TableQuery.DownTypeQuery();
dt.DataTextField="DownTypeName";
dt.DataValueField="DownTypeId";
dt.DataBind();
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
}
#endregion
protected void Button2_Click(object sender, System.EventArgs e)
{
if(name.Text=="")return;
using(DownType dt=new DownType(name.Text,false))
{
try
{
dt.Add();
Response.Write("<script>alert('添加成功');</script>");
}
catch(Exception ex)
{
Response.Write("<script>alert('"+ex.Message.ToString()+"');</script>");
}
}
BindType();
}
protected void Button3_Click(object sender, System.EventArgs e)
{
using(DownType d=new DownType(Convert.ToUInt32(dt.SelectedValue)))
{
try
{
d.Del();
Response.Write("<script>alert('删除成功');</script>");
}
catch(Exception ex)
{
Response.Write("<script>alert('"+ex.Message.ToString()+"');</script>");
}
}
BindType();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -