1
我正在使用c#与asp.net和SQL Server 2005作为后端。我想在窗体中使用下拉列表控件来填充文本框。下拉控件链接到数据库中的一列。我怎样才能在c#中编码?将数据库列链接到ASP.Net中的下拉控件
我正在使用c#与asp.net和SQL Server 2005作为后端。我想在窗体中使用下拉列表控件来填充文本框。下拉控件链接到数据库中的一列。我怎样才能在c#中编码?将数据库列链接到ASP.Net中的下拉控件
你的意思是这个
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.datasource = list;
DropDownList1.datBind();
}
protected void DropDownList1_OnSelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = DropDownList1.SelectedValue;
}
或者这
protected void DropDownList1_OnSelectedIndexChanged(object sender, EventArgs e)
{
TextBox t = new TextBox();
t.Text = DropDownList1.SelectedValue;
body.InnerHtml.add(t);
}
快速搜索会告诉你这样做的很多方面... – 2010-05-02 10:35:12