![](/img/trans.png)
[英]metabuilder checked listbox selected index changed not working on server
[英]why listbox selected index changed is not firing?
我已经编写了一个javascript
方法来对sortlistbox
项目进行sortlistbox
,并且在我在文本框中键入的项目被突出显示的意义上,它工作得很好。
但是,当我单击突出显示的项目时,它没有被选中。 为什么?
selectedIndexchanged
不起作用。
这是我的JavaScript代码:
function SearchList() {
var l = document.getElementById("<%= LBox.ClientID %>");
var tb = document.getElementById("<%= txtDepartments.ClientID %>");
if (tb.value == "") {
ClearSelection(l);
}
else {
for (var i = 0; i < l.options.length; i++) {
if (l.options[i].value.toLowerCase().match(tb.value.toLowerCase())) {
l.options[i].selected = true;
return false;
}
else {
ClearSelection(l);
}
}
}
}
function ClearSelection(l) {
l.selectedIndex = -1;
}
这样做,然后在内部调用函数, 您需要引用jquery库 :
$(document).ready(function() {
$('#' + '<%= DropdownName.ClientID %>').change(function() {
// Call function here...
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.