Completato comportamento corretto (base) x autocomplete!
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_autocomplete.ascx.cs" Inherits="PROJ_ETS.WebUserControls.mod_autocomplete" %>
|
||||
<script>
|
||||
$(function () {
|
||||
$(".searchinput").autocomplete({
|
||||
$("#<%=txtSelezione.ClientID %>").autocomplete({
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -26,42 +26,44 @@
|
||||
},
|
||||
select: function (e, i) {
|
||||
$("#<%=hiddenFieldID.ClientID %>").val(i.item.val);
|
||||
//$("#<%=btnPost.ClientID %>").click();
|
||||
$("#<%=txtSelezione.ClientID %>").val(i.item.label);
|
||||
$("#<%=btnPost.ClientID %>").click();
|
||||
},
|
||||
minLength: 2
|
||||
});
|
||||
});
|
||||
var prm = Sys.WebForms.PageRequestManager.getInstance();
|
||||
prm.add_endRequest(function () {
|
||||
var prm = Sys.WebForms.PageRequestManager.getInstance();
|
||||
prm.add_endRequest(function () {
|
||||
$(function () {
|
||||
// chiamate jquery da rieseguire post ajax update x partial page render
|
||||
$(function () {
|
||||
// chiamate jquery da rieseguire post ajax update x partial page render
|
||||
$(function () {
|
||||
$(".searchinput").autocomplete({
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
url: "/Services/WS_data.asmx/Test",
|
||||
data: "{'keywordStartsWith':'" + 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("Due to unexpected errors we were unable to load data");
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function (e, i) {
|
||||
$("#<%=txtSelezione.ClientID %>").autocomplete({
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
url: "/Services/WS_data.asmx/Test",
|
||||
data: "{'keywordStartsWith':'" + 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("Due to unexpected errors we were unable to load data");
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function (e, i) {
|
||||
$("#<%=hiddenFieldID.ClientID %>").val(i.item.val);
|
||||
//$("#<%=btnPost.ClientID %>").click();
|
||||
$("#<%=txtSelezione.ClientID %>").val(i.item.label);
|
||||
$("#<%=btnPost.ClientID %>").click();
|
||||
},
|
||||
minLength: 2
|
||||
});
|
||||
@@ -71,7 +73,7 @@
|
||||
</script>
|
||||
<label for="txtSelezione">Tags: </label>
|
||||
<asp:TextBox runat="server" ID="hiddenFieldID" AutoPostBack="true" OnTextChanged="hiddenFieldID_TextChanged" Visible="true"
|
||||
ViewStateMode="Enabled" Width="3em" Font-Size="6pt" BackColor="Transparent" BorderStyle="None" />
|
||||
ViewStateMode="Enabled" Width="0em" Font-Size="6pt" BackColor="Transparent" BorderStyle="None" />
|
||||
<asp:TextBox runat="server" ID="txtSelezione" CssClass="searchinput" OnTextChanged="txtSelezione_TextChanged" AutoPostBack="True" />
|
||||
<asp:Button runat="server" ID="btnPost" OnClick="btnPost_Click" Visible="true" Text="..." />
|
||||
<br />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user