I have a list in my model, EmployeeList
In my view, I want to populate an array from EmployeeList (from the model) and use it as tag autocomplete. It seems that the array is not populated with a list and autocomplete does not work. Help me please.
The code in the view is as follows:
<title>jQuery Autocomplete example</title> <script type="text/javascript" src="../../scripts/jquery-1.2.6.js"></script> <script type="text/javascript" src="../../scripts/jquery.autocomplete.js"></script> <script type="text/javascript"> $(document).ready(function() { var employeeList = '@Model.EmployeeLis.toArray();' $("#tags").autocomplete({ source: employeeList }); }); </script>
<h1>Type your name here</h1> <%= Html.TextBox("tags") %>
jquery asp.net-mvc-3 razor
learning
source share