[求助]如何让dropdownlist选择的内容显示在textbox中
如何让dropdownlist选择的内容显示在textbox中问题挺白,还望解答!!!
2006-12-14 10:32
2006-12-14 10:56
2006-12-14 16:27
2006-12-14 18:07
用JavaScript也可以实现
给DropDownList1添加个属性
this.DropDownList1.Attitude["changed"]="changed();";
function changed()
{
document.all.Form1.TextBox1.value=document.all.Form1.DropDownList1.value;
}

2006-12-15 09:04
2006-12-15 10:41
dropdownlist AutoPostBack属性设为true
在 SelectedIndexChanged事件里
textbox1.Text = dropdownlist1.SelectedItem.Text;

2006-12-15 17:02
谢谢大家,我试过了,问题是:
textbox获取到的总是dropdownlist选项中的第一项的内容
我绑定的dropdownlist,datatextfield属性是“用户名”,我就是想得用textbox来显示选择的用户名!
这样的话,应该怎么设啊?

2006-12-20 08:39
dropdownlist AutoPostBack属性设为true
在 SelectedIndexChanged事件里
textbox1.Text = dropdownlist1.SelectedItem.value;
是可以的,不知道你的具體意思是什么??
2006-12-20 09:25
2006-12-21 08:44