public static IHtmlString ThreeElements(this HtmlHelper helper, string useClass, IHtmlString left, IHtmlString middle, IHtmlString right) { return(new HtmlString(LayoutWork.ChildrenTemplate("childrenThird", HtmlMethods.addOrUpdateCssClass(left.ToString(), useClass), HtmlMethods.addOrUpdateCssClass(middle.ToString(), useClass), HtmlMethods.addOrUpdateCssClass(right.ToString(), useClass)))); }
public static IHtmlString CheckBoxes(this HtmlHelper helper, Dictionary <string, bool> isJoinedDictionary, string dictionaryName) { List <string> elements = new List <string>(); var s = nameof(isJoinedDictionary); foreach (var keyval in isJoinedDictionary) { var displayName = keyval.Key.Split(':')[0]; var htmlToPassValue = string.Format("{0}[{1}]", dictionaryName, keyval.Key); var checkbox = string.Format( @"<input {0} {1} {2} {3}> <input {4} {5} {6}> <label {7}>{8}</label>", HtmlMethods.attribute("id", displayName), HtmlMethods.attribute("name", htmlToPassValue), HtmlMethods.attribute("type", "checkbox"), HtmlMethods.attribute("value", "true") .ConcatIf((keyval.Value == true), " " + HtmlMethods.attribute("checked", "checked")), HtmlMethods.attribute("name", htmlToPassValue), HtmlMethods.attribute("type", "hidden"), HtmlMethods.attribute("value", "false"), HtmlMethods.attribute("for", displayName), displayName); elements.Add(checkbox); } var reduced = elements.Reduce("", (x, y) => { return(x += " " + y); }); return(new HtmlString(reduced)); }
public static IHtmlString Button(this HtmlHelper helper, string text) { var element = string.Format("<a {0}>{1}</a>", HtmlMethods.cssClass("button"), text); return(new HtmlString(Layout.Format(element))); }
public static IHtmlString Button(this HtmlHelper helper, string text, string onclick) { var element = string.Format("<a {0} {1}>{2}</a>", HtmlMethods.cssClass("button"), HtmlMethods.attribute("onClick", onclick), text); return(new HtmlString(Layout.Format(element))); }
public static IHtmlString Button(this HtmlHelper helper, string text, Dictionary <string, string> htmlAttributes) { var button = string.Format("<a {0}>{1}</a>", HtmlMethods.cssClass("button"), text); foreach (var v in htmlAttributes) { button = HtmlMethods.AddOrUpdateAttribute(button, v.Key, v.Value); } return(new HtmlString(Layout.Format(button))); }
public static IHtmlString Submit(this HtmlHelper helper, Dictionary <string, string> htmlAttributes) { var element = string.Format("<input {0} ></input>", HtmlMethods.attribute("type", "submit") ); foreach (var v in htmlAttributes) { element = HtmlMethods.AddOrUpdateAttribute(element, v.Key, v.Value); } return(new HtmlString(Layout.Format(element))); }
public static string ImageTextTemplate(string direction, string left, string right) { var template = "<div {0} >\n {1}{2} </div>\n <br {3}/>"; var html = String.Format(template, HtmlMethods.cssClass("imageText " + direction), Layout.Format(left, 1, 1), Layout.Format(right, 1, 1), HtmlMethods.cssClass("clearFloat") ); return(html); }
public static IHtmlString ImageTextLeft(this HtmlHelper helper, string containerClass, string imgSrc, string text) { return(new HtmlString(LayoutWork.ImageTextTemplate("left " + containerClass, string.Format("<img {0} />", HtmlMethods.attribute("src", imgSrc)), string.Format("<span >{0}</span>", text)))); }