Aggiunto comp toggle
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_toggle.ascx.cs" Inherits="GPW_Admin.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,149 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
public partial class cmp_toggle : System.Web.UI.UserControl
|
||||
{
|
||||
#region Public Events
|
||||
|
||||
/// <summary>
|
||||
/// Evento toggle
|
||||
/// </summary>
|
||||
public event EventHandler ehToggle;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Classe x toggle OFF
|
||||
/// </summary>
|
||||
public string classOff
|
||||
{
|
||||
get
|
||||
{
|
||||
return lbtToggleOff.CssClass;
|
||||
}
|
||||
set
|
||||
{
|
||||
lbtToggleOff.CssClass = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe x toggle ON
|
||||
/// </summary>
|
||||
public string classOn
|
||||
{
|
||||
get
|
||||
{
|
||||
return lbtToggleOn.CssClass;
|
||||
}
|
||||
set
|
||||
{
|
||||
lbtToggleOn.CssClass = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// Tooltip x toggle OFF
|
||||
/// </summary>
|
||||
public string tooltipOff
|
||||
{
|
||||
get
|
||||
{
|
||||
return lbtToggleOff.ToolTip;
|
||||
}
|
||||
set
|
||||
{
|
||||
lbtToggleOff.ToolTip = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tooltip x toggle ON
|
||||
/// </summary>
|
||||
public string tooltipOn
|
||||
{
|
||||
get
|
||||
{
|
||||
return lbtToggleOn.ToolTip;
|
||||
}
|
||||
set
|
||||
{
|
||||
lbtToggleOn.ToolTip = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// sistema visualizzazione
|
||||
/// </summary>
|
||||
private void fixDisplay()
|
||||
{
|
||||
// sistemo buttons & display...
|
||||
bool doShow = toggleValue;
|
||||
lbtToggleOn.Visible = doShow;
|
||||
lbtToggleOff.Visible = !doShow;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void lbtToggleOff_Click(object sender, EventArgs e)
|
||||
{
|
||||
toggleValue = !toggleValue;
|
||||
}
|
||||
|
||||
protected void lbtToggleOn_Click(object sender, EventArgs e)
|
||||
{
|
||||
toggleValue = !toggleValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// caricamento apgina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
fixDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -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_Admin.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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user