Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For this there is jquery autocomplete is there. <a href="http://docs.jquery.com/Plugins/Autocomplete" rel="nofollow">http://docs.jquery.com/Plugins/Autocomplete</a> what you need to do is just write a jquery code. suppose this is the text box in your view page.</p> <p>&lt; input type="text" id="AutoComplete" value="" /></p> <p>write a jquery for this textbox.</p> <pre><code>$(document).ready(function () { $("#AutoComplete").keypress(function () { var title = $("#AutoComplete").val(); var availableTags = []; if (title.length == 3) { $.get("/Wk/GetTitle/" + title, function (data) { var arr = jQuery.makeArray(data.split(',')); for (var i = 0; i &lt; arr.length; i++) { availableTags.push(arr[i]); } $("#AutoComplete").autocomplete({ source: availableTags }); </code></pre> <p>// $("#AutoComplete").select(); });</p> <pre><code> } }); }); </code></pre> <p>This will call action method using ajax and this action method return the list to show. here get title is the action method. the controller action code is </p> <pre><code> [HttpGet] public StringBuilder GetTitle(string inputString) { StringBuilder sb = new StringBuilder(); List&lt;string&gt; title = new List&lt;string&gt;(); int i = 0; string slug = RouteData.Values.Values.ElementAt(2).ToString(); title = pageBL.GetTitleAutocomplete(slug); for (i = 0; i &lt;= title.Count - 1; i++) { if (i != title.Count -1 ) sb = sb.Append(title.ElementAt(i) + ","); else sb = sb.Append(title.ElementAt(i) ); } return sb; } </code></pre> <p>This code will help you ask me if you get any prob</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload