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

📄 cst_categories_add.aspx.cs

📁 小型的一个简单的系统开发的实现了简---添加--删除--修改---(vs2005和SQl2005)用到了一些JS脚本
💻 CS
字号:
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;

public partial class Admin_CST_categories_add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToString(Session["name"]) == "")
        {
            Response.Write("<script language=javascript>alert('请登陆!');location='../login.aspx'</script>");
        }
        else
        {
 
       
        this.TxtID.Focus();
        if (!this.IsPostBack)
        {
            
            string strCategoriesID = Request["id"].ToString();
            if (strCategoriesID == "")
            {

            }
            else
            {
                Catories oCat = new Catories();
                DataRowView category_view = oCat.SelectTable(strCategoriesID).DefaultView[0];
                this.TxtID.Text = category_view["category_id"].ToString();
                this.TxtName.Text = category_view["name"].ToString();
                this.btOK.Text = "修改";
                this.LabF.Text = "修改类别名称";
                this.TxtID.Enabled = false;
                this.TxtName.Focus();
            }
        }
      }
       
    }
    protected void Button2_Click(object sender, EventArgs e)
    {   
        Catories oCat = new Catories();
        if (this.btOK.Text == "修改")
        {
          bool T=oCat.update(this.TxtID.Text, this.TxtName.Text);
          if (T)
          {
              Response.Write("<script>alert('修改成功!');history.back()</script>");
          }
          else
          {
              Response.Write("<script>alert('修改失败!');history.back()</script>");
 
          }
        }
        else
        {
            if (oCat.Add(this.TxtID.Text, this.TxtName.Text))
            {
                Response.Write("<script>alert('添加成功!');history.back()</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!');history.back()</script>");
 
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        this.TxtID.Text = "";
        this.TxtName.Text = "";
    }
}

⌨️ 快捷键说明

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