#region 事件: 选择一级类型
    protected void DropClassType_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
           string droptwo = "select * from [ClassType] where [ClassPid]=" + Convert.ToInt32(this.DropClassType.SelectedValue) + "";
           DataTable dtclasstwo = DataBase.ExecuteDataTable(droptwo, CommandType.Text, null);
            if (dtclasstwo != null)
            {
                this.dropClasstwo.DataSource = dtclasstwo;
                this.dropClasstwo.DataTextField ="ClassName";
                this.dropClasstwo.DataValueField ="ClassId";
                this.dropClasstwo.DataBind();
            }
            else
            {
                this.dropClasstwo.Items.Clear();
                this.dropClasstwo.Items.Add("");
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
    #endregion


//显示初始值
 protected void dropClasstwo_DataBound(object sender, EventArgs e)
    {
        dropClasstwo.Items.Insert(0, new ListItem("", "")); //原因listitem双引号里面不能有空格
        dropClasstwo.Text = "";

    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
猜你喜欢
  • 2021-07-25
  • 2022-02-09
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案