dt = db.GetDataSet("select * from model");
        DropDownList1.DataSource = dt.Tables[0];
        DropDownList1.DataTextField = "content";
        DropDownList1.DataValueField = "id";
       this. DropDownList1.DataBind();在绑定数据后可以正常显示,但用DropDownList1.SelectedValue和DropDownList1.SelectedItem.Text读取数据时返回的都是第一条记录的值。
请问哪出了问题

解决方案 »

  1.   

    if(!IsPostBack)
    {
    dt = db.GetDataSet("select * from model");
      DropDownList1.DataSource = dt.Tables[0];
      DropDownList1.DataTextField = "content";
      DropDownList1.DataValueField = "id";
      this. DropDownList1.DataBind();
    }
      

  2.   

    谢谢sqrc_lcl.
    可以了,呵呵
    这个问题头痛了好长时间
      

  3.   

    哪里也没有问题啊!
    DropDownList1.SelectedValue和DropDownList1.SelectedItem.Text
    显示的就是一条数据啊!如果显示多条的话就怪了!