forked from siteserver/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlerts.cs
More file actions
40 lines (34 loc) · 1.16 KB
/
Copy pathAlerts.cs
File metadata and controls
40 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Web.UI;
using SiteServer.Utils;
namespace SiteServer.BackgroundPages.Controls
{
public class Alerts : Control
{
public bool IsShowImmidiatary { get; set; }
public MessageUtils.Message.EMessageType MessageType { get; set; } = MessageUtils.Message.EMessageType.None;
public string Content { get; set; } = string.Empty;
public string Text
{
get
{
var state = ViewState["Text"];
if (state != null)
{
return (string)state;
}
return string.Empty;
}
set
{
ViewState["Text"] = value;
}
}
protected override void Render(HtmlTextWriter writer)
{
writer.Write(IsShowImmidiatary
? MessageUtils.GetAlertHtml(MessageType, Content, this)
: MessageUtils.GetAlertHtml(this, Text));
writer.Write(@"<div id=""alert"" class=""alert"" style=""display:none""><button type=""button"" class=""close"" data-dismiss=""alert"">×</button><strong>提示!</strong> <span id=""alertMessage""></span></div>");
}
}
}