我想是否成交的下拉菜单,状态是从数据库里读出来的,填充到dataset中,代码如下:DropDownList1.SelectedItem.Text = dst1.Tables[0].Rows[0]["Bargain"].ToString();为什么显示不出来呢?

解决方案 »

  1.   

    DropDownList1.Item.Add(dst1.Tables[0].Rows[0]["Bargain"].ToString().Trim());
      

  2.   

    DropDownList1.SelectedValue = dst1.Tables[0].Rows[0]["Bargain"].ToString
      

  3.   

    你DropDownList1事先有没有数据在里面的?
    你上面的那句是DropDownList1里有数据然后进行匹配时候用的
      

  4.   

    事先没数据的,是从数据库里读出来的?还有用DropDownList1.SelectedValue = dst1.Tables[0].Rows[0]["Bargain"].ToString
    也不行?
      

  5.   

    DropDownList1.Item.Add(dst1.Tables[0].Rows[0]["Bargain"].ToString().Trim());,也不可以,说是不包含对“Item”的定义?
      

  6.   

    ddl_F.Items.Insert(0,new ListItem("","")) ;
    ddl_F.Items.Add(new ListItem("text","value"));
      

  7.   

    你读出来的数据是1条,还是多条数据,原来DropDownList里是没有数据的把?读出来做什么用的?
      

  8.   

    为什么不直接绑定DropDownlist呢?
      

  9.   

    如果仅仅读出一条数据的话,那么用
    DropDownList1.Items.Add(dst1.Tables[0].Rows[0]["Bargain"].ToString().Trim());
    刚才少打了个S,嘿嘿,如果是多条数据放入DropDownList的话,建议使用绑定,然后在把SelectIndex=你要的那个值
      

  10.   

    DropDownlist.DataSource=dst1.Tables[0].Rows[0];
    DropDownlist.DataBind();
    然后再指定你要显示的是哪一列