diff --git a/PROJ-ETS/PROJ-ETS/Default.aspx b/PROJ-ETS/PROJ-ETS/Default.aspx index 335bb0f..024e25e 100644 --- a/PROJ-ETS/PROJ-ETS/Default.aspx +++ b/PROJ-ETS/PROJ-ETS/Default.aspx @@ -26,5 +26,5 @@ - + diff --git a/PROJ-ETS/PROJ-ETS/Services/WS_Data.asmx.cs b/PROJ-ETS/PROJ-ETS/Services/WS_Data.asmx.cs index d032f25..aca793a 100644 --- a/PROJ-ETS/PROJ-ETS/Services/WS_Data.asmx.cs +++ b/PROJ-ETS/PROJ-ETS/Services/WS_Data.asmx.cs @@ -18,12 +18,6 @@ namespace PROJ_ETS.Services public class WS_Data : System.Web.Services.WebService { - [WebMethod] - public string HelloWorld() - { - return "Hello World"; - } - [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string[] test(string keywordStartsWith) diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx index 2164fbe..5d8f232 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx @@ -6,7 +6,7 @@ $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", - url: "/Services/WS_data.asmx/Test", + url: "<%=txtServiceUrl.Text %>", data: "{'keywordStartsWith':'" + request.term + "'}", dataType: "json", async: true, @@ -29,8 +29,9 @@ $("#<%=txtSelezione.ClientID %>").val(i.item.label); $("#<%=btnPost.ClientID %>").click(); }, - minLength: 2 - }); + //minLength: 2 + minLength: <%=txtMinCharAutoCom.Text %> + }); }); var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(function () { @@ -42,7 +43,7 @@ $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", - url: "/Services/WS_data.asmx/Test", + url: "<%=txtServiceUrl.Text %>", data: "{'keywordStartsWith':'" + request.term + "'}", dataType: "json", async: true, @@ -61,20 +62,22 @@ }); }, select: function (e, i) { - $("#<%=hiddenFieldID.ClientID %>").val(i.item.val); - $("#<%=txtSelezione.ClientID %>").val(i.item.label); - $("#<%=btnPost.ClientID %>").click(); - }, - minLength: 2 + $("#<%=hiddenFieldID.ClientID %>").val(i.item.val); + $("#<%=txtSelezione.ClientID %>").val(i.item.label); + $("#<%=btnPost.ClientID %>").click(); + }, + //minLength: 2 + minLength: <%=txtMinCharAutoCom.Text %> }); - }); }); }); + }); - + -
- \ No newline at end of file + + + \ No newline at end of file diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx.cs index 2ca04e6..df80eff 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx.cs @@ -39,7 +39,15 @@ namespace PROJ_ETS.WebUserControls protected void txtSelezione_TextChanged(object sender, EventArgs e) { - lblVal.Text = string.Format("Chiave:{0}, valore {1}", hiddenFieldID.Text, txtSelezione.Text); + if (txtSelezione.Text.Trim() == "") + { + hiddenFieldID.Text = ""; + _valore = ""; + if (eh_valSelezionato != null) + { + eh_valSelezionato(this, new EventArgs()); + } + } } /// @@ -82,5 +90,129 @@ namespace PROJ_ETS.WebUserControls eh_valSelezionato(this, new EventArgs()); } } + + /// + /// valore (chiave) selezionato dal controllo (R public) + /// + public string valore + { + get + { + return hiddenFieldID.Text; + } + set + { + hiddenFieldID.Text = value; + } + } + /// + /// label selezionato dal controllo (R public) + /// + public string label + { + get + { + return txtSelezione.Text; + } + set + { + txtSelezione.Text = value; + } + } + /// + /// num minimo caratteri x autocomplete + /// + public Int32 minCharAutocomplete + { + get + { + return Convert.ToInt32(txtMinCharAutoCom.Text); + } + set + { + txtMinCharAutoCom.Text = value.ToString(); + } + } + /// + /// path del webservice (compreso metodo) + /// nb: DI NORMA fornisce risultati nel formato label#valore + /// + public string ServicePath + { + get + { + return txtServiceUrl.Text; + } + set + { + txtServiceUrl.Text = value; + } + } + /// + /// imposta visibilità della textBox delle chiavi + /// + public bool showKey + { + set + { + if (!value) + { + hiddenFieldID.Width = Unit.Pixel(0); + } + } + } + /// + /// imposta la stringa tooltip + /// + public string toolTip + { + set + { + txtSelezione.ToolTip = value; + } + } + + /// + /// larghezza textbox in unità EM + /// + public int textEmWidht + { + set + { + txtSelezione.Width = Unit.Parse(string.Format("{0}em", value)); + } + } + /// + /// imposta il focus sulla textBox + /// + public void setFocus() + { + txtSelezione.Focus(); + } + /// + /// permette di passare altri parametri di contesto al metodo invocato x autocomplete + /// + public string contextKey + { + get + { + return txtSelezione.AccessKey; + } + set + { + txtSelezione.AccessKey = value; + lblField.Text = string.Format("Cerca: ([{0}])", value); + } + } + /// + /// tabIndex del controllo + /// + public short TabIndex + { + set + { + txtSelezione.TabIndex = value; + } + } } } \ No newline at end of file diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx.designer.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx.designer.cs index 551c3ef..b2a03ad 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx.designer.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_autocomplete.ascx.designer.cs @@ -12,6 +12,15 @@ namespace PROJ_ETS.WebUserControls { public partial class mod_autocomplete { + /// + /// lblField control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblField; + /// /// hiddenFieldID control. /// @@ -40,12 +49,21 @@ namespace PROJ_ETS.WebUserControls { protected global::System.Web.UI.WebControls.Button btnPost; /// - /// lblVal control. + /// txtMinCharAutoCom control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Label lblVal; + protected global::System.Web.UI.WebControls.TextBox txtMinCharAutoCom; + + /// + /// txtServiceUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtServiceUrl; } } diff --git a/PROJ-ETS/PROJ-ETS/bin/ETS_Data.dll b/PROJ-ETS/PROJ-ETS/bin/ETS_Data.dll index fcca776..57fdcbc 100644 Binary files a/PROJ-ETS/PROJ-ETS/bin/ETS_Data.dll and b/PROJ-ETS/PROJ-ETS/bin/ETS_Data.dll differ diff --git a/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll b/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll index 34d1c37..91e9711 100644 Binary files a/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll and b/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll differ diff --git a/PROJ-ETS/PROJ-ETS/obj/Debug/PROJ-ETS.csprojResolveAssemblyReference.cache b/PROJ-ETS/PROJ-ETS/obj/Debug/PROJ-ETS.csprojResolveAssemblyReference.cache index 1f2c9bb..b20bd42 100644 Binary files a/PROJ-ETS/PROJ-ETS/obj/Debug/PROJ-ETS.csprojResolveAssemblyReference.cache and b/PROJ-ETS/PROJ-ETS/obj/Debug/PROJ-ETS.csprojResolveAssemblyReference.cache differ diff --git a/PROJ-ETS/PROJ-ETS/obj/Debug/PROJ-ETS.dll b/PROJ-ETS/PROJ-ETS/obj/Debug/PROJ-ETS.dll index 34d1c37..91e9711 100644 Binary files a/PROJ-ETS/PROJ-ETS/obj/Debug/PROJ-ETS.dll and b/PROJ-ETS/PROJ-ETS/obj/Debug/PROJ-ETS.dll differ