Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Asp.net mvc4

Posted on 2014-10-12
2
Medium Priority
?
143 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 12

Accepted Solution

by:
louisfr earned 2000 total points
ID: 40376835
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
ID: 40377566
Great thank you.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Don’ts and Dos are two important end products of software testing basics that a tester needs to regard. This article attempts to explain the principles of both.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

571 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