This question is locked. New answers and comments are not allowed.
I am using the AutoCompleteBox and when I use the client side onclose event, the value and the text return the same data (the message box will show something like "Combo box closed: { Pablo Picasso } id = Pablo Picasso").
Is there a way to get at the ID returned from my controller object?
Thanks, Dennis
here's my script:
<script type="text/javascript"> function ComboBox_OnClose(e) { var combobox = $(this).data('tAutoComplete'); var value = combobox.value(); var text = combobox.text(); alert("Combo box closed: { " + text + " } id = " + value); } </script>My Autocomplete is declared as follows:
<% Html.Telerik().AutoComplete() .Name("ArtistNameAutoComplete") .DataBinding(dataBinding => dataBinding .Ajax().Select("GetArtistNames", "Artist").Delay(300)) .ClientEvents(events => events.OnClose("ComboBox_OnClose")) .Render(); %>And my controller method looks like this:
public ActionResult GetArtistNames(string text) { AdminCatalogEntities ctx = new AdminCatalogEntities(); var anames = from a in ctx.Artists where a.Name.StartsWith(text) orderby a.Name select new VMIDName() { ID = a.ID, Name = a.Name }; return new JsonResult { Data = new SelectList(anames.ToList(), "ID", "Name") }; }