Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BootstrapPage : Page
- {
- public enum WarningType
- {
- Success,
- Info,
- Warning,
- Danger
- }
- public void ShowNotification(string message, WarningType type)
- {
- var mainContentHolder = Master.FindControl("MainContentPlaceHolder") as ContentPlaceHolder;
- Panel notificationPanel = new Panel();
- {
- LiteralControl closeButton = new LiteralControl();
- closeButton.Text = "<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>";
- Label notificationMessage = new Label() { Text = message };
- notificationPanel.Controls.Add(closeButton);
- notificationPanel.Controls.Add(notificationMessage);
- }
- notificationPanel.CssClass = string.Format("alert alert-{0} alert-dismissable", type.ToString().ToLower());
- notificationPanel.Attributes.Add("role", "alert");
- mainContentHolder.Controls.AddAt(0, notificationPanel);
- }
- }
- <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="DeceasedSystem.Site" %>
- var mainContentHolder = Master.FindControl("MainContentPlaceHolder") as ContentPlaceHolder;
Add Comment
Please, Sign In to add comment