A jQuery Autocomplete (with .Net) which actually works

Use JSBeautifier to format

JS:

$(“[id$=’_txtCountermandedBy’]”).autocomplete({
source: function(request, response) {
var param = { qry: $(“[id$=’_txtCountermandedBy’]”).val()
};
$.ajax({
type: “POST”,
url: “~/../MyWorkBasket.aspx/GetUserAutocomplete”,
data: JSON.stringify(param),
dataType: “json”,
contentType: “application/json; charset=utf-8”,
dataFilter: function(data) {
return data;
},
success: function(data) {
response($.map(data.d, function(item) {
return {
value: item.Value,
label: item.Label
}
}))
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
select: function(event, ui) {
//debugger;
$(“[id$=’_txtUserId’]”).val(ui.item.value);
$(“[id$=’_txtCountermandedBy’]”).val(ui.item.label);
OfficerSelected(true);
return false;
},
minLength: 3,
delay: 500
}).autocomplete(“widget”).addClass(“fixed-height”);
function OfficerSelected(state) {

if (state == true) {
$(“#imgUser”).attr(“src”, “~/../Styles/images/icons/tick.png”);
$(“#imgUser”).attr(“title”, “Officer selected”);
} else {
$(“#imgUser”).attr(“src”, “~/../Styles/images/icons/cross.png”);
$(“#imgUser”).attr(“title”, “Officer not selected”);
}
}

C#

[WebMethod(EnableSession = true)]
public static List<UserEntityMin> GetUserAutocomplete(string qry)
{

List<UserEntityMin> entList = UserUIC.GetUserAutocomplete(qry);
return entList;
}

public class UserEntityMin
{
string _userId;
string _fullDisplayName;

public string Value
{
get { return _userId; }
set { _userId = value; }
}
public string Label
{
get { return _fullDisplayName; }
set { _fullDisplayName = value; }
}
}

jQuery Ajax helper method

//Helper method to call page methods with AJAX
function PageMethod(fn, paramArray, successFn, errorFn) {

var pagePath = window.location.pathname;
//Create list of parameters in the form:
//{“paramName1″:”paramValue1″,”paramName2″:”paramValue2″}
var paramList = ”;
if (paramArray.length > 0) {
for (var i = 0; i < paramArray.length; i += 2) {
if (paramList.length > 0) paramList += ‘,’;
paramList += ‘”‘ + paramArray[i] + ‘”:”‘ + paramArray[i + 1] + ‘”‘;
}
}
paramList = ‘{‘ + paramList + ‘}’;
//Call the page method
$.ajax({
type: “POST”,
url: fn,
contentType: “application/json; charset=utf-8”,
data: paramList,
dataType: “json”,
success: successFn,
error: errorFn
});
}

How to unlock the Samsung Galaxy Ace GT-S5380

  • Perform factory reset – hold down power button and hold button simultaneously until the reset menu appears
  • Optional: connect phone to Kies to see check Android firmware version
  • Install Superuser app by Chainfire
  • Install Galaxy Ace unlock
  • Visit http://forum.xda-developers.com/showthread.php?t=1282011, download root.zip, and copy onto SD card
  • Reset phone and apply update from SD card, then reboot phone
  • Run Galaxy Ace unlock app, take note of codes
  • reboot phone and try one of the unlock codes