Inserito componente toggle x selezione generico

This commit is contained in:
Samuele E. Locatelli
2020-04-03 09:48:36 +02:00
parent 87439f2897
commit d51ecd6001
7 changed files with 203 additions and 27 deletions
+8
View File
@@ -441,6 +441,7 @@
<Content Include="Scripts\umd\popper.js" />
<Content Include="Scripts\umd\popper.min.js" />
<Content Include="WebMasterPages\AjaxSimpleFull.Master" />
<Content Include="WebUserControls\cmp_toggle.ascx" />
<Content Include="WebUserControls\mod_autocomplete.ascx" />
<Content Include="WebUserControls\mod_commAttivitaDesk.ascx" />
<Content Include="WebUserControls\mod_commUtLog.ascx" />
@@ -606,6 +607,13 @@
<Compile Include="WebMasterPages\AjaxSimpleFull.Master.designer.cs">
<DependentUpon>AjaxSimpleFull.Master</DependentUpon>
</Compile>
<Compile Include="WebUserControls\cmp_toggle.ascx.cs">
<DependentUpon>cmp_toggle.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="WebUserControls\cmp_toggle.ascx.designer.cs">
<DependentUpon>cmp_toggle.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_autocomplete.ascx.cs">
<DependentUpon>mod_autocomplete.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -0,0 +1,5 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_toggle.ascx.cs" Inherits="GPW_Commesse.WebUserControls.cmp_toggle" %>
<asp:HiddenField runat="server" ID="hfValue" />
<asp:LinkButton runat="server" ID="lbtToggleOn" OnClick="lbtToggleOn_Click" ToolTip="Nascondi TagCloud"><i class="fa fa-2x fa-toggle-on" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtToggleOff" OnClick="lbtToggleOff_Click" ToolTip="Mostra TagCloud"><i class="fa fa-2x fa-toggle-off" aria-hidden="true"></i></asp:LinkButton>
@@ -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
{
/// <summary>
/// Evento toggle
/// </summary>
public event EventHandler ehToggle;
/// <summary>
/// Tooltip x toggle ON
/// </summary>
public string tooltipOn
{
get
{
return lbtToggleOn.ToolTip;
}
set
{
lbtToggleOn.ToolTip = value;
}
}
/// <summary>
/// Tooltip x toggle OFF
/// </summary>
public string tooltipOff
{
get
{
return lbtToggleOff.ToolTip;
}
set
{
lbtToggleOff.ToolTip = value;
}
}
/// <summary>
/// Classe x toggle ON
/// </summary>
public string classOn
{
get
{
return lbtToggleOn.CssClass;
}
set
{
lbtToggleOn.CssClass = value;
}
}
/// <summary>
/// Classe x toggle OFF
/// </summary>
public string classOff
{
get
{
return lbtToggleOff.CssClass;
}
set
{
lbtToggleOff.CssClass = value;
}
}
/// <summary>
/// caricamento apgina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
fixDisplay();
}
}
/// <summary>
/// valore toggle
/// </summary>
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());
}
}
}
/// <summary>
/// sistema visualizzazione
/// </summary>
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;
}
}
}
+44
View File
@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace GPW_Commesse.WebUserControls
{
public partial class cmp_toggle
{
/// <summary>
/// Controllo hfValue.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfValue;
/// <summary>
/// Controllo lbtToggleOn.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtToggleOn;
/// <summary>
/// Controllo lbtToggleOff.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtToggleOff;
}
}
@@ -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" %>
<div class="row">
<div class="col-12 text-center">
@@ -13,8 +15,7 @@
<asp:ListItem Text="4 h" Value="240"></asp:ListItem>
<asp:ListItem Text="8 h" Value="480"></asp:ListItem>
</asp:RadioButtonList>
<asp:LinkButton runat="server" ID="lbtToggleOn" OnClick="lbtToggleOn_Click" ToolTip="Nascondi TagCloud"><i class="fa fa-2x fa-toggle-on" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtToggleOff" OnClick="lbtToggleOff_Click" ToolTip="Mostra TagCloud"><i class="fa fa-2x fa-toggle-off" aria-hidden="true"></i></asp:LinkButton>
<uc1:cmp_toggle runat="server" ID="cmp_toggle" tooltipOn="Nascondi TagCloud" tooltipOff="Mostra TagCloud" classOn="text-primary" classOff="text-primary" />
</div>
</div>
<div class="row" runat="server" id="tagBlock">
@@ -54,9 +54,6 @@ namespace GPW_Commesse.WebUserControls
/// </summary>
protected void setShowAdd()
{
// sistemo buttons & display...
lbtToggleOn.Visible = showAdd;
lbtToggleOff.Visible = !showAdd;
tagBlock.Visible = showAdd;
}
/// <summary>
@@ -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;
}
/// <summary>
/// Gestione evento toggle
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Cmp_toggle_ehToggle(object sender, EventArgs e)
{
showAdd = cmp_toggle.toggleValue;
}
/// <summary>
@@ -24,22 +24,13 @@ namespace GPW_Commesse.WebUserControls
protected global::System.Web.UI.WebControls.RadioButtonList rblOre;
/// <summary>
/// Controllo lbtToggleOn.
/// Controllo cmp_toggle.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtToggleOn;
/// <summary>
/// Controllo lbtToggleOff.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtToggleOff;
protected global::GPW_Commesse.WebUserControls.cmp_toggle cmp_toggle;
/// <summary>
/// Controllo tagBlock.