Click here to Skip to main content
12,552,255 members (51,321 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


10 bookmarked

Autosuggest using jQuery

, 7 Aug 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
I first tried using Ajax autocomplete, but found jQuery as an alternate


Alternative for the article  

Ajax was one alternate, an alternate can be using jQuery


For using jQuery autosuggest we need the js file "jquery.ui.autocomplete.autoSelect.js". Refer this link for download and help

Using the Code 

Once you have added the aotoselect.js for a textbox you will get a property named autocomplete

Add a textbox on which yo wish to apply autosuggest and write the script. My function  "GetAllSearchProducts" is getting all the products beginning with the letter typed in the textbox named "searchproduct"   

            <input name="" type="text" class="txtF ui-autocomplete-input" id="searchproduct"
                align="absmiddle" /><input name="" type="button" class="btimg" align="absmiddle"
                    onclick="SearchProduct();" /></div>


public JsonResult GetAllSearchProducts(string name = "")

          //get all products starting with the name provided
          var products = _productService.GetAllProducts(name).ToList();

          var result = from m in products
                      select new { m.Id, m.Name };

          return Json(result.ToList(), JsonRequestBehavior.AllowGet);

Points of Interest

Found it simple and easy to use.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Anuja Pawar Indore
Program Manager Diaspark
India India
I have keen interest in learning new things, exploring more on a topic and being more versatile

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161021.1 | Last Updated 7 Aug 2012
Article Copyright 2012 by Anuja Pawar Indore
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid