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 6689577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:32:09+00:00 2026-05-26T05:32:09+00:00

I am using a MooTools TextboxList in my MVC app to create an autocomplete

  • 0

I am using a MooTools TextboxList in my MVC app to create an autocomplete Tag suggester, similar to the StackOverflow one.

The script uses Json to do the suggestions. The Json string it seems to expect is different than I am able to generate. From the script’s demo, it should look something like this:

[[32,"Science",null,null]]

But I can’t figure out how to get the string to come out of MVC quite like that. Best I get looks more like:

[{"id":11,"text":"Science"}]

With the actual field names showing up.

Here is my controller method:

   public JsonResult Suggest(string search)
    {
        JsonResult jsonresult = new JsonResult();

        var tags = from t in db.Tags
                         where t.Text.Contains(search)
                         select new {id=t.TagID, text=t.Text};

        var result = DoSomethingTo(tags); // <---????????

        jsonresult.Data = result;

        jsonresult.JsonRequestBehavior = JsonRequestBehavior.AllowGet;

        return jsonresult;
    }

I’ve tried several variations of passing variables into the JsonResult.Data without much luck. I’ve tried arrays, custom objects, etc. I’m just not getting it. I’m certain it’s very

Edit: That should have said “I’m certain it’s very easy.”

  • 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-26T05:32:09+00:00Added an answer on May 26, 2026 at 5:32 am

    Based on another question, I ended up going old-school on it… building the string manually.

        public ContentResult Suggest(string search)
        {
            var tags = from t in db.Tags
                       where t.Text.Contains(search)
                       orderby (t.Text)
                       select t;
    
            var builder = new StringBuilder();
            builder.Append("[");
            foreach (Tag tag in tags)
                builder.AppendFormat("[{0}, \"{1}\", null, null]", tag.TagID, tag.Text);
            var result = builder.ToString().TrimEnd(new char[] { ',', ' ' }) + "]";
    
            ContentResult res = new ContentResult();
            res.Content = result;
    
            return res;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Mootools TextBoxList for a project. I was attempting to set the
I made a script (using mootools library) that is supposed to overlay an image
I am using mootools in one of my webpages. http://www.mstockphoto.net/drsdirect.net/pricing/tooltipsvn.html In this page the
I am using mootools library to call webservices in an asp.net application. one of
I've got a script using mootools 1.1 to handle an Ajax form that has
My script is throwing an error only in IE8. I'm using Mootools 1.3. The
I'm using mootools to create a scrollbar for content example code can be seen
i'm using this control http://devthought.com/projects/mootools/textboxlist/ It's using JQuery Code: bit.toElement().keydown(navigate); var navigate = function
I've been using Mootools for the last couple of months without knowing that MS
I have been using mootools for a year now. I need to use jquery

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.