我是新手,需要实现DropDownList1选择的内容在TextBox1中显示,同时触发TextBox1_TextChanged事件,而DropDownList1的AutoPostBack属性只能为False我在html里给DropDownList1加了一个onchange="change()"又在js里写了一个函数
function change()
{
var str
str =window.document.Form1.DropDownList1.options[Form1.ddlProduct.selectedIndex].value;
window.document.Form1.TextBox1.value=str;
}
我希望TextBox1的内容改变时触发TextBox1_TextChanged事件,请问有什么方法么?
有人说可以加隐藏控件,怎么加啊?
function change()
{
var str
str =window.document.Form1.DropDownList1.options[Form1.ddlProduct.selectedIndex].value;
window.document.Form1.TextBox1.value=str;
}
我希望TextBox1的内容改变时触发TextBox1_TextChanged事件,请问有什么方法么?
有人说可以加隐藏控件,怎么加啊?
如果还是没有触发,就在方法体里面调用__doPostBack
function change()
{
var str
str =window.document.Form1.DropDownList1.options[Form1.ddlProduct.selectedIndex].value;
window.document.Form1.TextBox1.value=str;
__doPostBack('TextBox1','');
}
我添加了__doPostBack('TextBox1','');显示页面错误阿,提示缺少对象
TextBox1_TextChanged事件需要调用数据库,在前台里写不了啊。
可以实现,刚才我自己写错了,谢谢Zoujinyucn结贴给分