Guest User

Untitled

a guest
Jan 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public class BootstrapPage : Page
  2. {
  3. public enum WarningType
  4. {
  5. Success,
  6. Info,
  7. Warning,
  8. Danger
  9. }
  10.  
  11. public void ShowNotification(string message, WarningType type)
  12. {
  13. var mainContentHolder = Master.FindControl("MainContentPlaceHolder") as ContentPlaceHolder;
  14. Panel notificationPanel = new Panel();
  15. {
  16. LiteralControl closeButton = new LiteralControl();
  17. closeButton.Text = "<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>";
  18.  
  19. Label notificationMessage = new Label() { Text = message };
  20.  
  21. notificationPanel.Controls.Add(closeButton);
  22. notificationPanel.Controls.Add(notificationMessage);
  23. }
  24. notificationPanel.CssClass = string.Format("alert alert-{0} alert-dismissable", type.ToString().ToLower());
  25. notificationPanel.Attributes.Add("role", "alert");
  26.  
  27. mainContentHolder.Controls.AddAt(0, notificationPanel);
  28. }
  29. }
  30.  
  31. <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="DeceasedSystem.Site" %>
  32.  
  33. var mainContentHolder = Master.FindControl("MainContentPlaceHolder") as ContentPlaceHolder;
Add Comment
Please, Sign In to add comment