toggler stato PL / scan carico
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_toggler.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_toggler" %>
|
||||
|
||||
<div class="row text-center textCondens">
|
||||
<div class="col-5">
|
||||
<asp:Label runat="server" ID="lblOff" CssClass="btn btn-info btn-sm btn-block" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<asp:HiddenField runat="server" ID="hfValue" />
|
||||
<asp:LinkButton runat="server" ID="lbtToggleOn" OnClick="lbtToggleOn_Click" ToolTip=""><i class="fa fa-2x fa-toggle-on" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbtToggleOff" OnClick="lbtToggleOff_Click" ToolTip=""><i class="fa fa-2x fa-toggle-off" aria-hidden="true"></i></asp:LinkButton>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<asp:Label runat="server" ID="lblOn" CssClass="btn btn-success btn-sm btn-block" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,181 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace MP_MAG.WebUserControls
|
||||
{
|
||||
public partial class cmp_toggler : 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>
|
||||
/// Text x toggle OFF
|
||||
/// </summary>
|
||||
public string textOff
|
||||
{
|
||||
get
|
||||
{
|
||||
return lblOff.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
lblOff.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Text x toggle ON
|
||||
/// </summary>
|
||||
public string textOn
|
||||
{
|
||||
get
|
||||
{
|
||||
return lblOn.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
lblOn.Text = 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;
|
||||
lblOn.Visible = doShow;
|
||||
lblOff.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
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MP_MAG.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_toggler
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// lblOff control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblOff;
|
||||
|
||||
/// <summary>
|
||||
/// hfValue control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfValue;
|
||||
|
||||
/// <summary>
|
||||
/// lbtToggleOn control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtToggleOn;
|
||||
|
||||
/// <summary>
|
||||
/// lbtToggleOff control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtToggleOff;
|
||||
|
||||
/// <summary>
|
||||
/// lblOn control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblOn;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user