zoukankan      html  css  js  c++  java
  • 有一个无效 SelectedValue,因为它不在项目列表中。异常

     #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 = "";

        }

  • 相关阅读:
    RAM,ROM,内存还有硬盘到底有什么区别呢
    MySQL中的这个池子
    apk安装包介绍(下载安装,存储的位置,路径,可以对里面的文件进行修改吗)
    论文查询
    PID算法
    数组指针与指针数组
    2020 最佳开源项目出炉
    反射机制调用无参和有参方法以及调用私有方法
    CSS概述 CSS声明
    WEB概述
  • 原文地址:https://www.cnblogs.com/freexiaoyu/p/1208957.html
Copyright © 2011-2022 走看看