Ridotti jscript della pagina autocomplete...
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_autocomplete.ascx.cs" Inherits="GMW.WebUserControls.mod_autocomplete" %>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
function setAutocomplete()
|
||||
{
|
||||
$("#<%=txtSelezione.ClientID %>").autocomplete({
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
@@ -33,43 +34,78 @@
|
||||
//minLength: 2
|
||||
minLength: <%=txtMinCharAutoCom.Text %>
|
||||
});
|
||||
}
|
||||
$(function () {
|
||||
setAutocomplete();
|
||||
//$("#<%=txtSelezione.ClientID %>").autocomplete({
|
||||
// source: function (request, response) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// contentType: "application/json; charset=utf-8",
|
||||
// url: "<%=txtServiceUrl.Text %>",
|
||||
// data: "{'prefixText':'" + request.term + "'}",
|
||||
// dataType: "json",
|
||||
// async: true,
|
||||
// success: function (data) {
|
||||
// //response(data.d);
|
||||
// response($.map(data.d, function (item) {
|
||||
// return {
|
||||
// label: item.split('#')[0],
|
||||
// val: item.split('#')[1]
|
||||
// }
|
||||
// }))
|
||||
// },
|
||||
// error: function (result) {
|
||||
// alert("Impossibile caricare i dati!");
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
// select: function (e, i) {
|
||||
// $("#<%=hiddenFieldID.ClientID %>").val(i.item.val);
|
||||
// $("#<%=txtSelezione.ClientID %>").val(i.item.label);
|
||||
// $("#<%=btnPost.ClientID %>").click();
|
||||
// },
|
||||
// //minLength: 2
|
||||
// minLength: <%=txtMinCharAutoCom.Text %>
|
||||
// });
|
||||
});
|
||||
var prm = Sys.WebForms.PageRequestManager.getInstance();
|
||||
prm.add_endRequest(function () {
|
||||
$(function () {
|
||||
// chiamate jquery da rieseguire post ajax update x partial page render
|
||||
$(function () {
|
||||
$("#<%=txtSelezione.ClientID %>").autocomplete({
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
url: "<%=txtServiceUrl.Text %>",
|
||||
data: "{'prefixText':'" + request.term + "'}",
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function (data) {
|
||||
//response(data.d);
|
||||
response($.map(data.d, function (item) {
|
||||
return {
|
||||
label: item.split('#')[0],
|
||||
val: item.split('#')[1]
|
||||
}
|
||||
}))
|
||||
},
|
||||
error: function (result) {
|
||||
alert("Impossibile caricare i dati!!!");
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function (e, i) {
|
||||
$("#<%=hiddenFieldID.ClientID %>").val(i.item.val);
|
||||
$("#<%=txtSelezione.ClientID %>").val(i.item.label);
|
||||
$("#<%=btnPost.ClientID %>").click();
|
||||
},
|
||||
//minLength: 2
|
||||
minLength: <%=txtMinCharAutoCom.Text %>
|
||||
});
|
||||
setAutocomplete();
|
||||
//$("#<%=txtSelezione.ClientID %>").autocomplete({
|
||||
// source: function (request, response) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// contentType: "application/json; charset=utf-8",
|
||||
// url: "<%=txtServiceUrl.Text %>",
|
||||
// data: "{'prefixText':'" + request.term + "'}",
|
||||
// dataType: "json",
|
||||
// async: true,
|
||||
// success: function (data) {
|
||||
// //response(data.d);
|
||||
// response($.map(data.d, function (item) {
|
||||
// return {
|
||||
// label: item.split('#')[0],
|
||||
// val: item.split('#')[1]
|
||||
// }
|
||||
// }))
|
||||
// },
|
||||
// error: function (result) {
|
||||
// alert("Impossibile caricare i dati!!!");
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
// select: function (e, i) {
|
||||
// $("#<%=hiddenFieldID.ClientID %>").val(i.item.val);
|
||||
// $("#<%=txtSelezione.ClientID %>").val(i.item.label);
|
||||
// $("#<%=btnPost.ClientID %>").click();
|
||||
// },
|
||||
// //minLength: 2
|
||||
// minLength: <%=txtMinCharAutoCom.Text %>
|
||||
// });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user