I am trying to use the @Html.TextBox() to get the input from the user, but it should act as an auto complete text box?
Values for the text box will be loaded at page load.
Any idea, how to do this?
I am trying to use the @Html.TextBox() to get the input from the user, but it should act as an auto complete text box?
Values for the text box will be loaded at page load.
Any idea, how to do this?
Use jQuery autocomplete plugin described http://jqueryui.com/autocomplete/
This sample gets the autocomplete suggestions via JSON from serer.
Implement Controller
and Action
to return JSON and query the database for suggestions.
Usually i have UtilitiesController
for this kind of Actions, i also recommend writing an extension method for creating AutoCompleteBox
, then you can use it @Html.AutoCompleteboxFor(...
Try this
$(document).ready(function () {
$("ControlID").attr('autocomplete', 'off');
});