By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,730 Members | 1,559 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,730 IT Pros & Developers. It's quick & easy.

Listbox selectindexchange not showing proper index value

P: 1
I am using visual basic 2017 for a web application, I am using a listbox and I write a code for searching data and if I click on another index item (rather than last search)
listbox selectindexchange not showing last clicked index. my code are like that pleas tell me where I am wrong
Expand|Select|Wrap|Line Numbers
  1. <asp:TextBox ID="TextBox21" runat="server" Onkeyup ="FilterItems(this.value)"  AutoPostBack ="True"
  2.  
  3. function FilterItems(value) {
  4.  
  5. ddl = document.getElementById("<%=ListBox1.ClientID %>");
  6.  
  7.         j1 = 0;
  8.         j = 1;
  9.         ok = 0;
  10.         if (ddl1 != null) 
  11.         {
  12.     for (i = 1; i < ddl1.options.length; i++) {
  13.                 ok = 0;
  14.  
  15.                 if(value.localeCompare((ddl1.options[i].innerHTML.substr(0, value.length))) !== 1) {
  16.                     if (value !== "") {
  17.                         ok = 1;
  18.                         j = i;
  19.  
  20.          ddl1.options[i].scrollIntoView(true);
  21.         ddl1.options[i].selected = true;
  22.         i = ddl1.options.length;
  23.         return false;
  24.  
  25.  
  26.                     }
  27.                 }
  28.             }
  29.          }
  30.            }
Dec 17 '19 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.