From d51ecd60019708eb86be9abc5074fa8307582f31 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 3 Apr 2020 09:48:36 +0200 Subject: [PATCH] Inserito componente toggle x selezione generico --- GPW_Commesse/GPW_Commesse.csproj | 8 ++ GPW_Commesse/WebUserControls/cmp_toggle.ascx | 5 + .../WebUserControls/cmp_toggle.ascx.cs | 130 ++++++++++++++++++ .../cmp_toggle.ascx.designer.cs | 44 ++++++ .../WebUserControls/mod_TagCloudProgetti.ascx | 5 +- .../mod_TagCloudProgetti.ascx.cs | 25 ++-- .../mod_TagCloudProgetti.ascx.designer.cs | 13 +- 7 files changed, 203 insertions(+), 27 deletions(-) create mode 100644 GPW_Commesse/WebUserControls/cmp_toggle.ascx create mode 100644 GPW_Commesse/WebUserControls/cmp_toggle.ascx.cs create mode 100644 GPW_Commesse/WebUserControls/cmp_toggle.ascx.designer.cs diff --git a/GPW_Commesse/GPW_Commesse.csproj b/GPW_Commesse/GPW_Commesse.csproj index c77a12e..0bb4a4b 100644 --- a/GPW_Commesse/GPW_Commesse.csproj +++ b/GPW_Commesse/GPW_Commesse.csproj @@ -441,6 +441,7 @@ + @@ -606,6 +607,13 @@ AjaxSimpleFull.Master + + cmp_toggle.ascx + ASPXCodeBehind + + + cmp_toggle.ascx + mod_autocomplete.ascx ASPXCodeBehind diff --git a/GPW_Commesse/WebUserControls/cmp_toggle.ascx b/GPW_Commesse/WebUserControls/cmp_toggle.ascx new file mode 100644 index 0000000..c60b13d --- /dev/null +++ b/GPW_Commesse/WebUserControls/cmp_toggle.ascx @@ -0,0 +1,5 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_toggle.ascx.cs" Inherits="GPW_Commesse.WebUserControls.cmp_toggle" %> + + + + \ No newline at end of file diff --git a/GPW_Commesse/WebUserControls/cmp_toggle.ascx.cs b/GPW_Commesse/WebUserControls/cmp_toggle.ascx.cs new file mode 100644 index 0000000..90a0549 --- /dev/null +++ b/GPW_Commesse/WebUserControls/cmp_toggle.ascx.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace GPW_Commesse.WebUserControls +{ + public partial class cmp_toggle : System.Web.UI.UserControl + { + /// + /// Evento toggle + /// + public event EventHandler ehToggle; + /// + /// Tooltip x toggle ON + /// + public string tooltipOn + { + get + { + return lbtToggleOn.ToolTip; + } + set + { + lbtToggleOn.ToolTip = value; + } + } + /// + /// Tooltip x toggle OFF + /// + public string tooltipOff + { + get + { + return lbtToggleOff.ToolTip; + } + set + { + lbtToggleOff.ToolTip = value; + } + } + + /// + /// Classe x toggle ON + /// + public string classOn + { + get + { + return lbtToggleOn.CssClass; + } + set + { + lbtToggleOn.CssClass = value; + } + } + /// + /// Classe x toggle OFF + /// + public string classOff + { + get + { + return lbtToggleOff.CssClass; + } + set + { + lbtToggleOff.CssClass = value; + } + } + + + /// + /// caricamento apgina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + fixDisplay(); + } + } + + /// + /// valore toggle + /// + public bool toggleValue + { + get + { + bool answ = false; + bool.TryParse(hfValue.Value, out answ); + return answ; + } + set + { + hfValue.Value = value.ToString(); + fixDisplay(); + if (ehToggle != null) + { + ehToggle(this, new EventArgs()); + } + } + } + /// + /// sistema visualizzazione + /// + private void fixDisplay() + { + // sistemo buttons & display... + bool doShow = toggleValue; + lbtToggleOn.Visible = doShow; + lbtToggleOff.Visible = !doShow; + } + + protected void lbtToggleOn_Click(object sender, EventArgs e) + { + toggleValue = !toggleValue; + } + + protected void lbtToggleOff_Click(object sender, EventArgs e) + { + toggleValue = !toggleValue; + } + } +} \ No newline at end of file diff --git a/GPW_Commesse/WebUserControls/cmp_toggle.ascx.designer.cs b/GPW_Commesse/WebUserControls/cmp_toggle.ascx.designer.cs new file mode 100644 index 0000000..b50ca5c --- /dev/null +++ b/GPW_Commesse/WebUserControls/cmp_toggle.ascx.designer.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace GPW_Commesse.WebUserControls +{ + + + public partial class cmp_toggle + { + + /// + /// Controllo hfValue. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfValue; + + /// + /// Controllo lbtToggleOn. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtToggleOn; + + /// + /// Controllo lbtToggleOff. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtToggleOff; + } +} diff --git a/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx b/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx index 4785b79..8e78fb4 100644 --- a/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx +++ b/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx @@ -1,4 +1,6 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_TagCloudProgetti.ascx.cs" Inherits="GPW_Commesse.WebUserControls.mod_TagCloudProgetti" %> +<%@ Register Src="~/WebUserControls/cmp_toggle.ascx" TagPrefix="uc1" TagName="cmp_toggle" %> +
@@ -13,8 +15,7 @@ - - +
diff --git a/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx.cs b/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx.cs index 0af484b..6bc308e 100644 --- a/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx.cs +++ b/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx.cs @@ -54,9 +54,6 @@ namespace GPW_Commesse.WebUserControls /// protected void setShowAdd() { - // sistemo buttons & display... - lbtToggleOn.Visible = showAdd; - lbtToggleOff.Visible = !showAdd; tagBlock.Visible = showAdd; } /// @@ -73,19 +70,19 @@ namespace GPW_Commesse.WebUserControls { modo = TagCloudMode.standard; } + cmp_toggle.toggleValue = showAdd; setShowAdd(); -#if false - // verifico se mostrare addnew... - if (!memLayer.ML.isInSessionObject("showAddNewRec")) - { - showAdd = memLayer.ML.BoolSessionObj("showAddNewRec"); - } - else - { - showAdd = true; - } -#endif } + cmp_toggle.ehToggle += Cmp_toggle_ehToggle; + } + /// + /// Gestione evento toggle + /// + /// + /// + private void Cmp_toggle_ehToggle(object sender, EventArgs e) + { + showAdd = cmp_toggle.toggleValue; } /// diff --git a/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx.designer.cs b/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx.designer.cs index 8c9b7b6..6534da4 100644 --- a/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx.designer.cs +++ b/GPW_Commesse/WebUserControls/mod_TagCloudProgetti.ascx.designer.cs @@ -24,22 +24,13 @@ namespace GPW_Commesse.WebUserControls protected global::System.Web.UI.WebControls.RadioButtonList rblOre; /// - /// Controllo lbtToggleOn. + /// Controllo cmp_toggle. /// /// /// Campo generato automaticamente. /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. /// - protected global::System.Web.UI.WebControls.LinkButton lbtToggleOn; - - /// - /// Controllo lbtToggleOff. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::System.Web.UI.WebControls.LinkButton lbtToggleOff; + protected global::GPW_Commesse.WebUserControls.cmp_toggle cmp_toggle; /// /// Controllo tagBlock.