I am creating a ASP.net /
VB.net application.
On the ASP.net they will be either typing in the information or using the scroll bar.
When they use the scroll bar it fires the "cboCode_SelectedIndexChanged" = Dropdownlist, but when they type it in and then tab out, it does not fire this code. Any ideas on how to fix this via JScript and samples?
//DropDown List in
VB.net
ddlCode.Attributes.Add("onkeypress", "return KeySortDropDownList_onkeypress(this,false)")
// JScript File
function KeySortDropDownList_onkeypress(dropdownlist,caseSe nsitive) {
// check the keypressBuffer attribute is defined on the dropdownlist
var undefined;
if (dropdownlist.keypressBuffer == undefined) {
dropdownlist.keypressBuffer = '';
}
// get the key that was pressed
var key = String.fromCharCode(window.event.keyCode);
dropdownlist.keypressBuffer += key;
if (!caseSensitive) {
// convert buffer to lowercase
dropdownlist.keypressBuffer = dropdownlist.keypressBuffer.toLowerCase();
}
// find if it is the start of any of the options
var optionsLength = dropdownlist.options.length;
for (var n=0; n < optionsLength; n++) {
var optionText = dropdownlist.options[n].text;
if (!caseSensitive) {
optionText = optionText.toLowerCase();
}
if (optionText.indexOf(dropdownlist.keypressBuffer,0) == 0) {
dropdownlist.selectedIndex = n;
return false; // cancel the default behavior since
// we have selected our own value
}
}
// reset initial key to be inline with default behavior
dropdownlist.keypressBuffer = key;
return true; // give default behavior
}
So it is not firing the (cboCode_SelectedIndexChanged).Accept and Award Points Accept as Solution