ddlAllUsers is an ASP.NET Combo box populated with user data.
searchTextBox is a html input control.
" input id="searchTextBox" onkeyup="searchSel()"
The following Javascript snippet shows what occurs on the KeyUp event.
The method searchSel() searches the Users combo with the txtSearch input, converts it to lower case and "if(output[i].text.toLowerCase().indexOf(input) == 0)" then it selects the closest match in the users combo box.
The indexOf() method returns the position of the first occurrence of a specified string value in a string.
Very useful if you need to locate a entry in the combo without going bind scrolling down the list.

No comments:
Post a Comment