TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sneha K
1.2k
527
195.6k
Autocomplete Dropdown is not working in mvc4?
Mar 14 2016 12:54 AM
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
<script>
$(function () {
$.ajax(
'@Url.Action("GetCustomers", "VisitorsForm")',{
type: "GET",
datatype: "Json",
success: function (data) {
$.each(data, function (index, value) {
$('#CustomerID').append('<option value="' + value.CustomerID + '">' + value.DisplayName + '</option>');
});
}
});
});
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..
Reply
Answers (
5
)
Why I am getting the 500 error only when I am posting the da
Require Coding For Search Button In ASP.Net using C#