Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6345721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:52:46+00:00 2026-05-24T20:52:46+00:00

I am trying to implement an autocomplete in ASP.NET MVC 3, following this post

  • 0

I am trying to implement an autocomplete in ASP.NET MVC 3, following this post
but I really can’t get it to work. I have looked at a series of other posts and blogs, but no success so far.

I have a DB table which contains regions (in Japanese), like so:

1 ハイチ; 2 ドミニカ共和国; 3 南アフリカ

basically a [key, Name] pair.

In my repository I am doing the following call:

public IQueryable<Region> GetAllRegions()
    {
        return db.Regions;
    }

Getting the raw data, which I pass to the controller, pair down the data according to input and the concatenate to a string like so:

    public class RegionsController : Controller
{
    Region_Repository rr = new Region_Repository();

    public string FindRegions(string q)
    {
        List<string> regions = rr.GetAllRegions().Select(r => r.Name).Where(s => s.StartsWith(q)).ToList();

        return string.Join("\n", regions);
    }

}

The controller when accessed via server/Regions/FindRegions/?q=ハ return a page with the single entry "ハイチ" as expected.

On the page I have a textbox with id "#NewRegion" and the script

<script type="text/javascript">
$(document).ready(function () {
    $("#NewRegion").autocomplete('@Url.Action("FindRegions", "Regions")');
})
</script>

which I placed underneath the textbox.

I have references to JQuery and JQueryUI from Google API which work since I am executing other JQuery and using the JQueryUI datepicker successfully on this page.

I tried placing the script in a separate file and hardcoding the url as ‘/Regions/FindRegions’, but no change. I had a look in firebug (second day only, so not very proficient at using it yet) and the script doesn’t seem to get executed.
The controller is called fine when accessed via URL, but anything I enter into the textbox does not get passed to the controller…

Can anybody see anything wrong with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:52:47+00:00Added an answer on May 24, 2026 at 8:52 pm

    According to the dark depths of the jQuery UI documentation, the parameter used when passing the autocomplete string to the server is called term, not q.

    Update: And also, initialize with autocomplete({source: "@(...url...)"}).

    Update 2: And also, return the type of data the Autocomplete widget expects, a JSON array of strings or a JSON array of objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem. Background I'm trying to implement an autocomplete selector with
I'm trying to implement a hasone relationship between 2 models, but I can't have
Im trying to implement an asp.net textbox using the jQuery UI Autocomplete widget http://jqueryui.com/demos/autocomplete/#remote
I have an ASP.NET webforms application and trying to implement jQuery autocomplate on a
Trying to implement an autocomplete based on this It looks like it's very straight
I am trying to get AutoComplete to work on a website application I am
I am trying to implement SO style autocomplete. I am using this gem to
I'm trying to implement an autocomplete field. I want this autocomplete to retrieve the
Trying to implement an autocomplete box ultimately. For now im following php academy's lead.
Referring to this post and this one . I'm trying to implement tag search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.