Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. public static class HeaderHelper
  2. {
  3. public static MvcHtmlString StandardHeader(this HtmlHelper htmlHelper,
  4. string title,
  5. string description="")
  6. {
  7. var tbSection= new TagBuilder("div");
  8. tbSection.AddCssClass("page-header");
  9.  
  10. var tbTitle = new TagBuilder("h2") {InnerHtml = title};
  11. if (!string.IsNullOrEmpty(description))
  12. {
  13. var tbDescription = new TagBuilder("p") {InnerHtml = description};
  14. tbSection.InnerHtml = string.Concat(tbTitle, tbDescription);
  15. }
  16. else
  17. {
  18. tbSection.InnerHtml = tbTitle.ToString();
  19. }
  20.  
  21. return MvcHtmlString.Create(tbSection.ToString());
  22. }
  23. }
  24.  
  25. @Html.StandardHeader("View Employees")
  26.  
  27. @Html.StandardHeader("Edit Employee","...some description...")
  28.  
  29. @Html.StandardHeader(ViewBag.Title)
  30.  
  31. @Html.StandardHeader(ViewBag.Title.ToString())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement