DataTable listC = mLqsBo.GetTypeTwoByTypeValue(List.Rows[0]["CTypeValue"].ToString()); 
            if (listC.Rows.Count > 0) 
            { 
                this.RidioSort.DataSource = listC; 
                this.RidioSort.DataTextField = "TypeNameT"; 
                this.RidioSort.DataValueField = "TypeValueT"; 
                this.RidioSort.DataBind(); 
            } 提示“RidioSort”有一个无效 SelectedValue,因为它不在项目列表中,这个问题应该怎么解决?最好是希望能够设置RidioSort的属性就可以解决

解决方案 »

  1.   

    貌似问题不是在这里.而是在你给this.RidioSort设置初值的地方.
      

  2.   

    那应该怎么给初始啊...我是用textbox添加名称和值保存到数据库然后用DropDownList绑定这些值...那应该要怎么搞?
      

  3.   

       protected void Page_Load(object sender, EventArgs e)
        {
    if (!this.IsPostBack)
                {
                    BindType();
    }
    }
      private void BindType()
        {
              DataTable listR = mLqsBo.GetAllTypeInfo();          if (listR.Rows.Count > 0)
              {
                  this.RidioSort.DataSource = listR;
                  this.RidioSort.DataTextField = "TypeName";
                  this.RidioSort.DataValueField = "TypeValue";
                  
                  this.RidioSort.DataBind();
                           }
    能否留下QQ联系?