select_students.aspx.cs

来自「很不错的学生管理系统」· CS 代码 · 共 82 行

CS
82
字号
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;
using es_business = com.egt.business;

public partial class StuMessage_select_students : System.Web.UI.Page
{
    private es_business.StudentAttribute StuAtt = new com.egt.business.StudentAttribute();
    private es_business.User m_user;
    private es_business.student stu = new com.egt.business.student();
    private DataSet ds;

    protected void Page_Load(object sender, EventArgs e)
    {
        #region 绑定学员信息列表
        if (!Page.IsPostBack)
        {
            ds = stu.select_student();
            if (ds != null)
            {
                this.Grvstudent.DataSource = ds;
                this.Grvstudent.DataBind();
            }
            else
            {
                this.Grvstudent.DataSource = null;
                this.Grvstudent.DataBind();
            }
            ds = stu.select_class();
            if (ds != null)
            {
                this.drop_classid.DataTextField = ds.Tables[0].Columns["name"].ColumnName;
                this.drop_classid.DataValueField = ds.Tables[0].Columns["id"].ColumnName;
                this.drop_classid.DataSource = ds;
                this.drop_classid.DataBind();
            }
            else 
            {
                this.drop_classid.Items.Clear();
            }
        }
        #endregion
    }
 

    protected void btn_submit_Click(object sender, EventArgs e)
    {
        #region 初试化属性
        this.m_user = (es_business.User)this.Session["user"];
        StuAtt.landnames = this.txt_landnames.Text;
        StuAtt.names = this.txt_names.Text;
        StuAtt.password = this.txt_password.Text;
        StuAtt.phone = this.txt_phone.Text;
        StuAtt.schoolname = this.drop_schoolname.SelectedValue;
        StuAtt.classid = Convert.ToInt32(this.drop_classid.SelectedValue);
        StuAtt.address = this.txt_address.Text;
        StuAtt.sex = this.rab_sex.SelectedValue;
        StuAtt.state = this.rab_state.SelectedValue;
        #endregion

        #region 修改学员信息
        int i = stu.new_student(StuAtt);
        if (i == 1)
        {
            Response.Write("<script language=javascript>window.alert('新建成功');</script>");    
        }
        else
        {
            Response.Write("<script language=javascript>window.alert('新建成功');</script>");    
        }
        #endregion
        
    }
}

⌨️ 快捷键说明

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