DropDownList2.SelectedValue = cd.ToString();我的DropDownList2中有数据在我给他指定他数据当中的一个值的时候
他不听话了..不给值例我的DropDownList2
有 200801
200802
200803
200804
200805
200806
200807
200808
200809
200810
DropDownList2.SelectedValue = "200802";在另一个页面  就没问题  他的当前值变了02但在我现在用的这个页面 他就没反应....谁知道是个什么问题

解决方案 »

  1.   

    有使用数据绑定吗?有使用DataValueField属性吗?
      

  2.   

    不管是  用绑定 或用ITEM.ADD增加
    都不行.....
      

  3.   


    DropDownList2.DataSource = ts.TimeNow().Tables[0];
            DropDownList2.DataTextField = "ym";
            DropDownList2.DataValueField = "ym";
            DropDownList2.DataBind();
            string cd = "";
            cd = po.DateTimeNow12();
            //dds= ts.TimeNow();
            //for(int i= 0; i<dds.Tables[0].Rows.Count;i++)
            //{
            //    DropDownList2.Items.Add(dds.Tables[0].Rows[i][0].ToString());
            //}
            DropDownList2.SelectedValue = cd.ToString();
    两种方法 但 在这个页面 我就不知道为什么  不能指定值在另一个地方就没问题