HyperLesson/Admin/Class-A.aspx.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using BLL;
using Model;

namespace HyperLesson
{
    public partial class Class_A : System.Web.UI.Page
    {
        //数据绑定方法
        private void Bind()
        {
            GridView1.DataSource = ClassManager.getCategoryList();
            GridView1.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //非回发判断
            if (!IsPostBack)
            {
                Bind();
                this.Button1.Attributes.Add("onclick", "return confirm('确认删除选中的项目吗??')");
            }
        }
        //删除
        protected void GridView1__RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string ClassName = GridView1.Rows[e.RowIndex].Cells[2].Text;
            if (ClassManager.Delete(int.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text)))
            {
                Response.Write("<script>alert('删除"+ClassName+"成功!');location.href='Class-A.aspx';</script>");
            }
            else
                Response.Write("<script>alert('删除失败!');location.href='Class-A.aspx';</script>");
            Bind();
        }
        //更新
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            banji ban = new banji();
            ban.ClassID = int.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text);
            ban.ClassName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text;
            ban.ClassCode = int.Parse(((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text);
            Boolean result = ClassManager.updata(ban);
            if (result)
            {
                Response.Write("<script>alert('更新完成!');location.href='Class-A.aspx';</script>");
                this.GridView1.EditIndex = -1;
                Bind();
            }
            else
            {
                Response.Write("<script>alert('更新失败!');location.href='Class-A.aspx';</script>");
            }
后面还有 128 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。