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

  • Home
  • SEARCH
  • 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 6094745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:42:56+00:00 2026-05-23T12:42:56+00:00

I am using jQuery UI Autocomplete with ASP.NET like this : First I am

  • 0

I am using jQuery UI Autocomplete with ASP.NET like this :
First I am serializing Good names into string array then I passing Array to source of jQuery UI AutoComplete

   //PageLoad
    tadok.Entities.TList<tadok.Entities.Good> GoodEntites = tadok.Data.DataRepository.GoodProvider.GetAll();
    List<string> GoodNames = new List<string>();
    foreach (object item_loopVariable in GoodEntites) {
        item = item_loopVariable;
        GoodNames.Add(string.Format(item.GodTitle));

    }
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    Values = serializer.Serialize(GoodNames);

MarkUp Code :

  var availableTags = <%= Values %>
       $("#txtGoodAutoComplete").autocomplete({
         source: availableTags

          });

The object that I am serializing has property with the name ID. How can I serialize ID and storing ID in for example Hidden field on Select item event of autocomplete ?
Update
My main challenge is how to Serialize ID ?

  • 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-23T12:42:57+00:00Added an answer on May 23, 2026 at 12:42 pm

    Use select event,

    If your object is looks like {'label':'A', 'value':'A', 'ID':'7897975'}

    $( ".selector" ).autocomplete({
    select: function(event, ui) { 
         $('#hiddenField').val(ui.item.ID);//Item is your selected object.
    }
    });
    

    Update:

    I have never worked on C#. But there should be any built in JSON parser available.

    In java i create JSON format like this,

    JSONArray jsonArray = new JSONArray();
    JSONObject jsonObject = null;
    
    for(Country country : countries){
                    jsonObject = new JSONObject();
                    jsonObject.put("label", country.getName());
                    jsonObject.put("value", country.getCode());
                    jsonObject.put("id", country.getId().toString());
                    jsonArray.add(jsonObject);
                }
    String json = jsonArray.toJSONString();//The json string will look like, [{'label':'A', 'value':'A', 'id':'7897925'},{'label':'B', 'value':'B', 'id':'7497975'},{'label':'C', 'value':'C', 'id':'7843975'},{'label':'D', 'value':'D', 'id':'7857975'}]
    
    //Your autocomplete source should return something like the above json string
    


    By using Javascript Serializer :
    First Add a class :

    public class GoodAutoComplete
    {
        public string label;
        public string value;
        public string ID;
    }
    

    Then Serialize object like this :

    tadok.Entities.TList<tadok.Entities.Good> GoodEntites = tadok.Data.DataRepository.GoodProvider.GetAll();
    List<GoodAutoComplete> GoodItems = new List<GoodAutoComplete>();
    foreach (object item_loopVariable in GoodEntites) {
        item = item_loopVariable;
        GoodItems.Add(new GoodAutoComplete {
            ID = item.GodId,
            label = string.Format(item.GodTitle + "{(0)}", item.GodDescrp).Replace("()", ""),
            value = string.Format(item.GodTitle + "{(0)}", item.GodDescrp).Replace("()", "")
        });
    }
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    Values = serializer.Serialize(GoodItems);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone used jQuery to populate an autocomplete list on a textbox using ASP.NET
I'm using asp.NET MVC, and am looking at the JQuery autocomplete plugin for what
Im using jquery autocomplete can I pass extraParams to webservice in asp.net ? and
Im trying to implement an asp.net textbox using the jQuery UI Autocomplete widget http://jqueryui.com/demos/autocomplete/#remote
I am using jQuery Autocomplete on my ASP.net page. I am not sure how
i am using JQuery UI Autocomplete with asp.net textbox. AutoComplete works right. but how
Hi I'm using jQuery AutoComplete Plugin in ASP.Net as outlined in the article below,
I am using an Autocomplete jquery plugin in my ASP.NET site, and I cannot
I am using jQuery UI Autocomplete plugin for better data input in my ASP.NET
i´m new developing on asp.net mvc, and even newer using jquery, so this is

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.