Is there a way to add name/value functionality to jquery autocomplete for .net?
- by Mark Kadlec
I've recently added the JQuery autocomplete plug in and have a textbox that autocompletes a list of employees. It works great and I commend the authors of the plugin.
I think the textbox would be MUCH more useful though, when upon selecting, we can extract the StaffID (Ie. retreive the value of the selection). My code is below and you can see that I am simply adding the staff names, would be nice to associate IDs.
Does anyone know of any way to do this?
My JQuery:
$(document).ready(function() {
$("#txtStaff").autocomplete('autocompletetagdata.aspx');
});
My ASPX page:
protected void Page_Load(object sender, EventArgs e)
{
StaffViewListClass staffList = StaffViewListClass.GetStaff();
StringBuilder sb = new StringBuilder();
foreach (StaffViewClass staff in staffList)
{
sb.Append(staff.FullName).Append("\n");
}
Response.Write(sb.ToString());
}