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

📄 default.aspx.cs

📁 这是asp.net^和Visual C++Sharp编写的串并口通讯的书籍 源代码
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
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 System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bindDDL(DropDownList1);
            bindDDL(DropDownList2);
            bindDDL(DropDownList3);
            bindDDL(DropDownList5);
        }
    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        removeDDL();
    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        removeDDL();
    }
    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
    {
        removeDDL();
    }
    
    protected void DropDownList5_SelectedIndexChanged(object sender, EventArgs e)
    {
        removeDDL();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Session["Page"] = DropDownList5.SelectedValue;
        Session["Row"] = DropDownList2.SelectedValue;
        Session["Column"] = DropDownList1.SelectedValue;
        Session["Data"] = DropDownList3.SelectedValue;
        Session["OMethod"] = DropDownList4.SelectedValue;
        try
        {
            Response.Redirect("Default2.aspx");
        }
        catch
        {
            Response.Write("<script>alert('数据字段不能为日期类型,请重新选择!')</script>");
        }
    }
    protected void bindDDL(DropDownList ddl)
    {
        string strCon = "Data Source=(local);Database=db_05;Uid=sa;Pwd=";
        SqlConnection sqlcon = new SqlConnection(strCon);
        SqlDataAdapter da = new SqlDataAdapter("SELECT a.name FROM syscolumns as a inner join sysobjects as b on a.id=b.id WHERE b.name = '员工信息表'", sqlcon);
        DataSet ds = new DataSet();
        da.Fill(ds);
        ddl.DataSource = ds;
        ddl.DataTextField = "name";
        ddl.DataBind();
    }
    protected void removeDDL()
    {
        DropDownList1.Items.Remove(DropDownList5.SelectedValue);
        DropDownList2.Items.Remove(DropDownList5.SelectedValue);
        DropDownList2.Items.Remove(DropDownList1.SelectedValue);
        DropDownList3.Items.Remove(DropDownList5.SelectedValue);
        DropDownList3.Items.Remove(DropDownList1.SelectedValue);
        DropDownList3.Items.Remove(DropDownList2.SelectedValue);
    }
}

⌨️ 快捷键说明

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