Solved

Asp.net mvc4

Posted on 2014-10-12
2
136 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 Winforms Signing 13 32
edit .asp files 5 31
Notify sent to other threads in Java 9 33
using CK editor in iframes 5 18
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
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.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importingā€¦
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

829 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