<script type="text/javascript">
aut(document).ready(function () {
debugger;
aut("#<%=txtfname.ClientID%>").autocomplete({
source: function (request, response) {
debugger;
aut.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Default.aspx/GetFacilityName",
data: "{'FacilityName':'" + document.getElementById("<%=txtfname.ClientID%>").value + "'}",
dataType: "json",
success: function (data) {
debugger;
response(data.d);
},
error: function (result) {
alert("Error");
}
});
},
select: function (event, ui) {
debugger;
var label = ui.item.label;
var value = ui.item.value;
aut.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Default.aspx/GetDetailsByFacName",
data: "{'FacilityName':'" + label + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
debugger;
aut('#<%=ddloredringPhysician.ClientID%>').val(data.d[0]);
aut('#<%=lblphone.ClientID%>').val(data.d[1]);
aut('#<%=lblFax.ClientID%>').val(data.d[2]);
aut('#<%=lblContact.ClientID%>').val(data.d[3]);
aut('#<%=lblCourierName.ClientID%>').val(data.d[4]);
aut('#<%=lblCourierPhone.ClientID%>').val(data.d[5]);
},
error: function (data) {
debugger;
}
})
}
});
});
</script>
[WebMethod]
public static List<string> GetDetailsByFacName(string FacilityName)
{
FacilityBL objDB = new FacilityBL();
if (!string.IsNullOrEmpty(FacilityName))
{
var facility = objDB.SelectAll().Where(x => (x.FacilityName.Contains(FacilityName)));
List<string> strNamesData = new List<string>();
foreach (var item in facility)
{
strNamesData.Add(item.FacilityName);
strNamesData.Add(item.Phone);
strNamesData.Add(item.Fax);
strNamesData.Add(item.Contact);
strNamesData.Add(item.FacilityID);
strNamesData.Add(item.CourierName);
strNamesData.Add(item.CourierPhone);
}
return strNamesData.ToList();
}
else
{
return null;
}
}
I want to set web method value to label or dropdown controls at the same time.How to set the value after "Default.aspx/GetDetailsByFacName" method call to controls.
Thanks.