DropDownList 编程下拉框显示问题...?急..在线等啊..

来源:百度知道 编辑:UC知道 时间:2024/05/03 07:22:14
有数据表Org
ID OrgName
1 **公司
2 信息中心
3 人力资源部
aspx页面上 控件 一个 DropDownlist;二个 TextBox
怎么在后台写protected void ddlDisplayOrg_SelectedIndexChanged(object sender, EventArgs e)事件...

SqlConnection con = new SqlConnection("连接字符串")
con.Open();
SqlCommand cmd = new SqlCommand("select * from org", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
this.DropDownList1.DataSource = ds;
DropDownList1.DataTextField = "orgname";
this.DropDownList1.DataBind();