Solved

Asp.net mvc4

Posted on 2014-10-12
2
122 Views
Last Modified: 2014-10-13
Hi guys ,

I have some mvc4 app and I'm trying to implement autocomplete on one of my textbox and it is not functioning.

here is my C# code and jquery:

 public JsonResult Autocompletecode(string Description)
        {
            rmsmasterdbtestEntities db = new rmsmasterdbtestEntities();
            var auto = from s in db.Items select s.Description;
            var namelist = auto.Where(n => n.ToLower().StartsWith(Description.ToLower()));

            return Json(namelist, JsonRequestBehavior.AllowGet);
        }

Open in new window


 $(function () {
            $("#Description").autocomplete({
                source: "/Ajax/Autocompletecode",
                minLength: 1,
               
            });
        });

Open in new window

0
Comment
Question by:Moti Mashiah
2 Comments
 
LVL 11

Accepted Solution

by:
louisfr earned 500 total points
Comment Utility
Change the method parameter name to "term":
public JsonResult Autocompletecode(string term)

Open in new window

That's the default when using an url as source.
0
 
LVL 1

Author Closing Comment

by:Moti Mashiah
Comment Utility
Great thank you.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now