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 ?