Solved

Asp.net mvc4

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

813 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

9 Experts available now in Live!

Get 1:1 Help Now