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

        }

  • 相关阅读:
    VMware Workstation 6.0 正式版公布
    KMyMoney:全体理财好管家
    Bugzilla 3.0 公布
    Brightside:切换工作区的小东西
    QTM-Blogging 客户端
    MDF2ISO-将 MDF 转换为 ISO
    Yakuake 2.8 beta1
    Red Hat 的 Liberation 字体
    Dictman:有效的词典呆板人
    digiKam 0.9.2 Beta 1
  • 原文地址:https://www.cnblogs.com/freexiaoyu/p/1208957.html
Copyright © 2011-2022 走看看