43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
public partial class admin__uc_alert : System.Web.UI.UserControl
|
|
{
|
|
//asp.net Framework 4.8 website 預設不支援 C#6功能替代方案
|
|
private alert_type? _Type = alert_type.info;
|
|
public alert_type? Type {
|
|
get { return _Type; }
|
|
set {
|
|
_Type = value;
|
|
ChangeStatus();
|
|
}
|
|
}
|
|
private string _Text;
|
|
public string Text {
|
|
get { return _Text; }
|
|
set {
|
|
_Text = value;
|
|
ChangeStatus();
|
|
}
|
|
}
|
|
private string init_class= "alert d-flex align-items-center mx-2";
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
//init_class = alert.Attributes["class"];
|
|
ChangeStatus();
|
|
}
|
|
protected void ChangeStatus()
|
|
{
|
|
alert.Visible = !(Type == null || String.IsNullOrEmpty(Text));
|
|
alert.Attributes["class"] = init_class + " alert-" + Type;
|
|
}
|
|
}
|
|
public enum alert_type
|
|
{
|
|
info, success, warning, danger
|
|
} |