Hi I have one field called CustomerName it is Dropdown. I want to make this field as Auotcomplete dropdown instead of selecting the value . but i cant get any idea to do this task . im getting lot of confusions so please any one help me to solve this issue
My Controller code
public JsonResult GetCustomers()
{
return Json(db.Customers.ToList(), JsonRequestBehavior.AllowGet);}
My View Code
@Html.Label("Customer Name", new { @class = "control-label" })
@Html.DropDownListFor(model => model.CustomerID, new SelectList(string.Empty, "Value", "Text"), "Please select a Customer", new { @class = "form-control required", type = "text" })
My J-query Code
$(function () {
$.ajax(
'@Url.Action("GetCustomers", "VisitorsForm")',{
type: "GET",
datatype: "Json",
success: function (data) {
$.each(data, function (index, value) {
$('#CustomerID').append('');
});
}
});
});
this is my code it will load the CustomerName in CustomerName Field from Db. Please any one help me to do that Autocomplete dropdown task. I tried manys but no use no one is working..
Advance Thanks..
Sneha KPosted Mar 14, 2016, 6:28 AM
AmanPosted Mar 14, 2016, 6:14 AM
Saillesh PawarPosted Mar 14, 2016, 1:42 AM
Sneha KPosted Mar 14, 2016, 1:14 AM
Saillesh PawarPosted Mar 14, 2016, 1:11 AM