DropDownList动态绑定的数据无法读出
DropDownList动态绑定的数据无法读出,只能读出第一个的数据
程序如下:
protected void Page_Load(object sender, EventArgs e)
{
DataSet TempDs2 = DatabaseOp.ReturnDataSet(SelectCityCommand2);
DropDownList1.DataSource = TempDs2.Tables[0];
DropDownList1.DataTextField = "cityname";
DropDownList1.DataValueField = "threecode";
DropDownList1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = DropDownList1.SelectedValue+DropDownList1.SelectedIndex.ToString().Trim();
}