/// <summary> /// Check whether we can actually display as button /// </summary> /// <param name="html">Current HTML element</param> /// <returns>True if can display as button, else False</returns> public static bool CanDisplayAsButton(IExtendedHtmlString html) { // We can only display hyperlinks and button as buttons Type t = html.GetType(); return(t == typeof(Hyperlink) || t == typeof(Button)); }
/// <summary> /// Create an HtmlListItem from the given item /// </summary> /// <param name="item">Item to convert to a list item</param> /// <returns>A HtmlListItem</returns> public static HtmlListItem From(IExtendedHtmlString item) { HtmlListItem li = new HtmlListItem(string.Empty); li.AppendTags.Add(item.Component); return(li); }
/// <summary> /// Add html addon to the form control /// </summary> /// <param name="html">HTML to be added</param> /// <param name="append">[Optional] Whether to append or prepend the addon</param> /// <returns>The updated form control</returns> public IFormControl <TModel, TValue> AddHtml(IExtendedHtmlString html, bool append = true) { Component = Component.AddHtml(html.Component, append); return(this); }