我真的很困惑爲什麼我的自動完成工作不正常。你能幫我解釋爲什麼這不起作用嗎?即使日期時間選擇器不工作,我想知道是否它是我使用「Gentellela Alela」的模板。請幫助我的傢伙。在此先感謝JQuery UI自動完成不工作asp.net
下面是代碼
<link href="Styles/bootstrap.min.css" rel="stylesheet" />
<link href="Styles/font-awesome.min.css" rel="stylesheet" />
<link href="Styles/nprogress.css" rel="stylesheet" />
<link href="Styles/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet" />
<link href="Styles/daterangepicker.css" rel="stylesheet" />
<link href="Styles/jqvmap.min.css" rel="stylesheet" />
<link href="Styles/custom.min.css" rel="stylesheet" />
<link href="Styles/cust.css" rel="stylesheet" />
<link href="Styles/style.css" rel="stylesheet" />
<script src="~/Scripts/jquery-ui-1.12.1.js"></script>
<script type="text/javascript">
$(function() {
$("#<%= txtProdCode.ClientID%>").autocomplete({
source: function (request, response) {
$.ajax({
url: "<%:Page.ResolveUrl("~/WS/Platts.asmx/FilterItem")%>",
data: "{ 'filterstring': '" + request.term + "' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.prDesc,
value: item.prDesc
}
}))
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
}
});
},
minLength: 2
});
});
</script>
Windows服務(的.asmx)
<WebMethod()> _
Public Function FilterItem(ByVal filterstring As String) As List(Of ProductDetail)
Dim retEmp As New List(Of ProductDetail)
Using secrpt As New BLL.TradingModel.TradingTransactionRepository
retEmp = secrpt.GetAllPlattCode().Where(Function(c) c.prDesc.ToLower.Contains(filterstring)).ToList
End Using
Return retEmp
End Function
庫
Public Function GetAllPlattCode() As List(Of ProductDetail)
Return (From _plt As ProductDetail In TradingTransactionCTX.ProductDetails Order By _plt.pID).ToList
End Function
有沒有主頁? –
@SaadSuri是的,有一個主頁 – jezz
然後嘗試調用您的文本框的主名稱。你可以通過檢查元素找到它。 –