title: typeahead.js replace asp.net dropdownlist key/value
body: <p>My goal is to replace an asp.net dropdownlist using typeahead.js.  I have an asp.net web service which returns a list of General Ledger Accounts encoded in json with an example below:</p>
  
  <p>["10000 - Test Account","10001 - Test Account 2"]</p>
  
  <p>Using a standard asp dropdown list I might assign the Name property to "10000 - Test Account" and the value property to 1 (whatever ID is in my database).  When I click the "add" button I would then use the value of the General Ledger item.  I can easily modify my webservice to return both a name and ID for each object however I don't know how to modify my typeahead code to store an id value from my database for each item and additionally how I can retrieve that value on selection of a GL.  My only solution at this point is to substring the first 5 chars of the name and do another database lookup but it just seems messy.  Any input would be greatly appreciated.</p>
  
  <p><strong>Snapshot from WebPage</strong>
  <a href="https://i.stack.imgur.com/LVKPJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LVKPJ.png" alt="Image"></a>
  </p>
  
  <p><strong>Typeahead Code</strong></p>
  
  <pre><code>   $(document).ready(function () {
          $('.typeahead').typeahead([
                {
                    name: 'theName',
                    remote: '/webservice.asmx/GetGLS?query=%QUERY',
                    limit: 10
                }
          ]);
      });  
  </code></pre>