I just want to know if there's a way to fill the jQuery AutoComplete with a Key Value Pair return object?
<script type="text/javascript">
$(document).ready(function() {
var data = WebAppPortal.Services.Generic.GenericService.GetAllIRespondents(onSuccess, onFail);
});
var onFail = function() {
$.fn.closeModal("Error in update", true, false);
};
var onSuccess = function(data) {
//var data2 = data.split("$");
$("#<%=TextBox1.ClientID %>").autocomplete(data2, {
max: 6,
highlightItem: true,
multiple: true,
multipleSeparator: ",",
});
};
</script>
Server side code:
[WebMethod(true)]
public Dictionary<string, object> GetAllIRespondents()
{
Dictionary<string, object> allRespondents = new Dictionary<string, object>();
UserInformationViewDC[] users = new UserInformationViewController().FetchAll(MWEQPortal.GetTenantId(),
UserInformationViewDC.Columns.Userstatuscode,
MWEQCommonConstants.UserStatusActive,
UserInformationViewDC.Columns.Fullname);
foreach (UserInformationViewDC user in users)
{
allRespondents.Add(user.Fullname, user.Usercode);
}
return allRespondents;
}
Hope to find solution in the issue, Many Thanks.
Regards,
Renz.