/// <summary> /// Write text inside tags of type HtmlTextWriterTag /// </summary> /// <param name="html">HtmlTextWriter instance object</param> /// <param name="value">Input text / string</param> /// <param name="tag">Value of HtmlTextWriterTag enumaration</param> /// <returns>HtmlTextWriter reference</returns> public static HtmlTextWriter InsertText(this HtmlTextWriter html, string value, HtmlTextWriterTag tag) { CheckNullParam(html); html.WriteBeginTag(tag.ToString()); html.Write(HtmlTextWriter.TagRightChar); html.Write(value); html.WriteEndTag(tag.ToString()); return html; }
internal static string BuildOneTag(string virtualPath, HtmlTextWriterTag tag) { TagRenderMode tagRenderMode; var tagBuilder = new TagBuilder(tag.ToString().ToLower()); var absolutePath = VirtualPathUtility.ToAbsolute(virtualPath); switch (tag) { case HtmlTextWriterTag.Script: tagRenderMode = TagRenderMode.Normal; tagBuilder.MergeAttribute("type", "text/javascript"); tagBuilder.MergeAttribute("src", absolutePath); break; case HtmlTextWriterTag.Link: tagRenderMode = TagRenderMode.SelfClosing; tagBuilder.MergeAttribute("type", "text/css"); tagBuilder.MergeAttribute("media", "all"); //always ALL? tagBuilder.MergeAttribute("rel", "stylesheet"); tagBuilder.MergeAttribute("href", absolutePath); break; default: throw new InvalidOperationException(); } return tagBuilder.ToString(tagRenderMode); }
/// <summary> /// Initializes a new instance of the HtmlTag class. Renders the opening tag of an HTML node, including any attributes. /// </summary> /// <param name="writer"> /// The HTMLTextWriter. /// </param> /// <param name="tag"> /// The type of HTML tag. /// </param> /// <param name="style"> /// The style. /// </param> /// <param name="attributes"> /// HTML attributes. /// </param> public HtmlTag(HtmlTextWriter writer, HtmlTextWriterTag tag, TagStyle style, params HtmlAttribute[] attributes) { this.writer = writer; this.attributes = attributes; this.tag = tag.ToString().ToLower(); this.tagStyle = style; this.StartRender(); }
private String GetTagName(HtmlTextWriterTag key) { String name = key.ToString().ToLower(); if (name.Contains(".")) { name = name.Substring(name.LastIndexOf(".") + 1); } return(name); }
private static void WriteStartTagWithClass(HtmlHelper htmlHelper, HtmlTextWriterTag tag, string containerClass, IDictionary <string, object> otherHtmlAttributes) { var tagBuilder = new TagBuilder(tag.ToString().ToLower()); if (otherHtmlAttributes != null) { tagBuilder.MergeAttributes(otherHtmlAttributes); } tagBuilder.MergeAttribute("class", containerClass); htmlHelper.ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.StartTag)); }
public TagBuilder ToTagBuilder() { var tagBuilder = new TagBuilder(_tagType.ToString()) { InnerHtml = InnerHtml }; tagBuilder.MergeAttributes(Attributes); //replace style attribute value if (StyleValues.Count > 0) { tagBuilder.MergeAttribute(HtmlTextWriterAttribute.Style.ToString(), ComposeStyleAttributeValue()); } return(tagBuilder); }
public static string AsText(this HtmlTextWriterTag tag) { return(tag.ToString().ToLower()); //switch (tag) //{ // case HtmlTextWriterTag.A: return "a"; // case HtmlTextWriterTag.Body: return "body"; // case HtmlTextWriterTag.Br: return "br"; // case HtmlTextWriterTag.Button: return "button"; // case HtmlTextWriterTag.Caption: return "caption"; // case HtmlTextWriterTag.Col: return "col"; // case HtmlTextWriterTag.Colgroup: return "colgroup"; // case HtmlTextWriterTag.Div: return "div"; // case HtmlTextWriterTag.Form: return "form"; // case HtmlTextWriterTag.H1: return "h1"; // case HtmlTextWriterTag.H2: return "h2"; // case HtmlTextWriterTag.H3: return "h3"; // case HtmlTextWriterTag.H4: return "h4"; // case HtmlTextWriterTag.H5: return "h5"; // case HtmlTextWriterTag.H6: return "h6"; // case HtmlTextWriterTag.Head: return "head"; // case HtmlTextWriterTag.Html: return "html"; // case HtmlTextWriterTag.Img: return "img"; // case HtmlTextWriterTag.Input: return "input"; // case HtmlTextWriterTag.Li: return "li"; // case HtmlTextWriterTag.Link: return "link"; // case HtmlTextWriterTag.P: return "p"; // case HtmlTextWriterTag.Span: return "span"; // case HtmlTextWriterTag.Table: return "table"; // case HtmlTextWriterTag.Tbody: return "tbody"; // case HtmlTextWriterTag.Td: return "td"; // case HtmlTextWriterTag.Th: return "th"; // case HtmlTextWriterTag.Thead: return "thead"; // case HtmlTextWriterTag.Tr: return "tr"; // case HtmlTextWriterTag.Ul: return "ul"; // case HtmlTextWriterTag.Unknown: return "unknown"; // default: throw new NotSupportedException("Unsupported HtmlTextWriterTag. Use a string instead"); //} }
protected override string GetTagName (HtmlTextWriterTag tagKey) { if (tagKey == HtmlTextWriterTag.Unknown || !Enum.IsDefined (typeof (HtmlTextWriterTag), tagKey)) return ""; return tagKey.ToString ().ToLower (CultureInfo.InvariantCulture); /* The code below is here just in case we need to split things up switch (tagkey) { case HtmlTextWriterTag.Unknown: return ""; case HtmlTextWriterTag.A: return "a"; case HtmlTextWriterTag.Acronym: return "acronym"; case HtmlTextWriterTag.Address: return "address"; case HtmlTextWriterTag.Area: return "area"; case HtmlTextWriterTag.B: return "b"; case HtmlTextWriterTag.Base: return "base"; case HtmlTextWriterTag.Basefont: return "basefont"; case HtmlTextWriterTag.Bdo: return "bdo"; case HtmlTextWriterTag.Bgsound: return "bgsound"; case HtmlTextWriterTag.Big: return "big"; case HtmlTextWriterTag.Blockquote: return "blockquote"; case HtmlTextWriterTag.Body: return "body"; case HtmlTextWriterTag.Br: return "br"; case HtmlTextWriterTag.Button: return "button"; case HtmlTextWriterTag.Caption: return "caption"; case HtmlTextWriterTag.Center: return "center"; case HtmlTextWriterTag.Cite: return "cite"; case HtmlTextWriterTag.Code: return "code"; case HtmlTextWriterTag.Col: return "col"; case HtmlTextWriterTag.Colgroup: return "colgroup"; case HtmlTextWriterTag.Dd: return "dd"; case HtmlTextWriterTag.Del: return "del"; case HtmlTextWriterTag.Dfn: return "dfn"; case HtmlTextWriterTag.Dir: return "dir"; case HtmlTextWriterTag.Div: return "table"; case HtmlTextWriterTag.Dl: return "dl"; case HtmlTextWriterTag.Dt: return "dt"; case HtmlTextWriterTag.Em: return "em"; case HtmlTextWriterTag.Embed: return "embed"; case HtmlTextWriterTag.Fieldset: return "fieldset"; case HtmlTextWriterTag.Font: return "font"; case HtmlTextWriterTag.Form: return "form"; case HtmlTextWriterTag.Frame: return "frame"; case HtmlTextWriterTag.Frameset: return "frameset"; case HtmlTextWriterTag.H1: return "h1"; case HtmlTextWriterTag.H2: return "h2"; case HtmlTextWriterTag.H3: return "h3"; case HtmlTextWriterTag.H4: return "h4"; case HtmlTextWriterTag.H5: return "h5"; case HtmlTextWriterTag.H6: return "h6"; case HtmlTextWriterTag.Head: return "head"; case HtmlTextWriterTag.Hr: return "hr"; case HtmlTextWriterTag.Html: return "html"; case HtmlTextWriterTag.I: return "i"; case HtmlTextWriterTag.Iframe: return "iframe"; case HtmlTextWriterTag.Img: return "img"; case HtmlTextWriterTag.Input: return "input"; case HtmlTextWriterTag.Ins: return "ins"; case HtmlTextWriterTag.Isindex: return "isindex"; case HtmlTextWriterTag.Kbd: return "kbd"; case HtmlTextWriterTag.Label: return "label"; case HtmlTextWriterTag.Legend: return "legend"; case HtmlTextWriterTag.Li: return "li"; case HtmlTextWriterTag.Link: return "link"; case HtmlTextWriterTag.Map: return "map"; case HtmlTextWriterTag.Marquee: return "marquee"; case HtmlTextWriterTag.Menu: return "menu"; case HtmlTextWriterTag.Meta: return "meta"; case HtmlTextWriterTag.Nobr: return "nobr"; case HtmlTextWriterTag.Noframes: return "noframes"; case HtmlTextWriterTag.Noscript: return "noscript"; case HtmlTextWriterTag.Object: return "object"; case HtmlTextWriterTag.Ol: return "ol"; case HtmlTextWriterTag.Option: return "option"; case HtmlTextWriterTag.P: return "p"; case HtmlTextWriterTag.Param: return "param"; case HtmlTextWriterTag.Pre: return "pre"; case HtmlTextWriterTag.Q: return "q"; case HtmlTextWriterTag.Rt: return "rt"; case HtmlTextWriterTag.Ruby: return "ruby"; case HtmlTextWriterTag.S: return "s"; case HtmlTextWriterTag.Samp: return "samp"; case HtmlTextWriterTag.Script: return "script"; case HtmlTextWriterTag.Select: return "select"; case HtmlTextWriterTag.Small: return "small"; case HtmlTextWriterTag.Span: return "span"; case HtmlTextWriterTag.Strike: return "strike"; case HtmlTextWriterTag.Strong: return "strong"; case HtmlTextWriterTag.Style: return "style"; case HtmlTextWriterTag.Sub: return "sub"; case HtmlTextWriterTag.Sup: return "sup"; case HtmlTextWriterTag.Table: return "table"; case HtmlTextWriterTag.Tbody: return "tbody"; case HtmlTextWriterTag.Td: return "td"; case HtmlTextWriterTag.Textarea: return "textarea"; case HtmlTextWriterTag.Tfoot: return "tfoot"; case HtmlTextWriterTag.Th: return "th"; case HtmlTextWriterTag.Thead: return "thead"; case HtmlTextWriterTag.Title: return "title"; case HtmlTextWriterTag.Tr: return "tr"; case HtmlTextWriterTag.Tt: return "tt"; case HtmlTextWriterTag.U: return "u"; case HtmlTextWriterTag.Ul: return "ul"; case HtmlTextWriterTag.Var: return "var"; case HtmlTextWriterTag.Wbr: return "wbr"; case HtmlTextWriterTag.Xml: return "xml"; default: return ""; } */ }
private String GetTagName(HtmlTextWriterTag key) { String name = key.ToString().ToLower(); if (name.Contains(".")) name = name.Substring(name.LastIndexOf(".") + 1); return name; }
protected override string GetTagName(HtmlTextWriterTag tagKey) { if (tagKey == HtmlTextWriterTag.Unknown || !Enum.IsDefined(typeof(HtmlTextWriterTag), tagKey)) { return(String.Empty); } return(tagKey.ToString().ToLower(Helpers.InvariantCulture)); /* The code below is here just in case we need to split things up * switch (tagkey) { * case HtmlTextWriterTag.Unknown: * return String.Empty; * case HtmlTextWriterTag.A: * return "a"; * case HtmlTextWriterTag.Acronym: * return "acronym"; * case HtmlTextWriterTag.Address: * return "address"; * case HtmlTextWriterTag.Area: * return "area"; * case HtmlTextWriterTag.B: * return "b"; * case HtmlTextWriterTag.Base: * return "base"; * case HtmlTextWriterTag.Basefont: * return "basefont"; * case HtmlTextWriterTag.Bdo: * return "bdo"; * case HtmlTextWriterTag.Bgsound: * return "bgsound"; * case HtmlTextWriterTag.Big: * return "big"; * case HtmlTextWriterTag.Blockquote: * return "blockquote"; * case HtmlTextWriterTag.Body: * return "body"; * case HtmlTextWriterTag.Br: * return "br"; * case HtmlTextWriterTag.Button: * return "button"; * case HtmlTextWriterTag.Caption: * return "caption"; * case HtmlTextWriterTag.Center: * return "center"; * case HtmlTextWriterTag.Cite: * return "cite"; * case HtmlTextWriterTag.Code: * return "code"; * case HtmlTextWriterTag.Col: * return "col"; * case HtmlTextWriterTag.Colgroup: * return "colgroup"; * case HtmlTextWriterTag.Dd: * return "dd"; * case HtmlTextWriterTag.Del: * return "del"; * case HtmlTextWriterTag.Dfn: * return "dfn"; * case HtmlTextWriterTag.Dir: * return "dir"; * case HtmlTextWriterTag.Div: * return "table"; * case HtmlTextWriterTag.Dl: * return "dl"; * case HtmlTextWriterTag.Dt: * return "dt"; * case HtmlTextWriterTag.Em: * return "em"; * case HtmlTextWriterTag.Embed: * return "embed"; * case HtmlTextWriterTag.Fieldset: * return "fieldset"; * case HtmlTextWriterTag.Font: * return "font"; * case HtmlTextWriterTag.Form: * return "form"; * case HtmlTextWriterTag.Frame: * return "frame"; * case HtmlTextWriterTag.Frameset: * return "frameset"; * case HtmlTextWriterTag.H1: * return "h1"; * case HtmlTextWriterTag.H2: * return "h2"; * case HtmlTextWriterTag.H3: * return "h3"; * case HtmlTextWriterTag.H4: * return "h4"; * case HtmlTextWriterTag.H5: * return "h5"; * case HtmlTextWriterTag.H6: * return "h6"; * case HtmlTextWriterTag.Head: * return "head"; * case HtmlTextWriterTag.Hr: * return "hr"; * case HtmlTextWriterTag.Html: * return "html"; * case HtmlTextWriterTag.I: * return "i"; * case HtmlTextWriterTag.Iframe: * return "iframe"; * case HtmlTextWriterTag.Img: * return "img"; * case HtmlTextWriterTag.Input: * return "input"; * case HtmlTextWriterTag.Ins: * return "ins"; * case HtmlTextWriterTag.Isindex: * return "isindex"; * case HtmlTextWriterTag.Kbd: * return "kbd"; * case HtmlTextWriterTag.Label: * return "label"; * case HtmlTextWriterTag.Legend: * return "legend"; * case HtmlTextWriterTag.Li: * return "li"; * case HtmlTextWriterTag.Link: * return "link"; * case HtmlTextWriterTag.Map: * return "map"; * case HtmlTextWriterTag.Marquee: * return "marquee"; * case HtmlTextWriterTag.Menu: * return "menu"; * case HtmlTextWriterTag.Meta: * return "meta"; * case HtmlTextWriterTag.Nobr: * return "nobr"; * case HtmlTextWriterTag.Noframes: * return "noframes"; * case HtmlTextWriterTag.Noscript: * return "noscript"; * case HtmlTextWriterTag.Object: * return "object"; * case HtmlTextWriterTag.Ol: * return "ol"; * case HtmlTextWriterTag.Option: * return "option"; * case HtmlTextWriterTag.P: * return "p"; * case HtmlTextWriterTag.Param: * return "param"; * case HtmlTextWriterTag.Pre: * return "pre"; * case HtmlTextWriterTag.Q: * return "q"; * case HtmlTextWriterTag.Rt: * return "rt"; * case HtmlTextWriterTag.Ruby: * return "ruby"; * case HtmlTextWriterTag.S: * return "s"; * case HtmlTextWriterTag.Samp: * return "samp"; * case HtmlTextWriterTag.Script: * return "script"; * case HtmlTextWriterTag.Select: * return "select"; * case HtmlTextWriterTag.Small: * return "small"; * case HtmlTextWriterTag.Span: * return "span"; * case HtmlTextWriterTag.Strike: * return "strike"; * case HtmlTextWriterTag.Strong: * return "strong"; * case HtmlTextWriterTag.Style: * return "style"; * case HtmlTextWriterTag.Sub: * return "sub"; * case HtmlTextWriterTag.Sup: * return "sup"; * case HtmlTextWriterTag.Table: * return "table"; * case HtmlTextWriterTag.Tbody: * return "tbody"; * case HtmlTextWriterTag.Td: * return "td"; * case HtmlTextWriterTag.Textarea: * return "textarea"; * case HtmlTextWriterTag.Tfoot: * return "tfoot"; * case HtmlTextWriterTag.Th: * return "th"; * case HtmlTextWriterTag.Thead: * return "thead"; * case HtmlTextWriterTag.Title: * return "title"; * case HtmlTextWriterTag.Tr: * return "tr"; * case HtmlTextWriterTag.Tt: * return "tt"; * case HtmlTextWriterTag.U: * return "u"; * case HtmlTextWriterTag.Ul: * return "ul"; * case HtmlTextWriterTag.Var: * return "var"; * case HtmlTextWriterTag.Wbr: * return "wbr"; * case HtmlTextWriterTag.Xml: * return "xml"; * default: * return String.Empty; * } */ }
public HtmlTag(HtmlTextWriterTag tag) : this(tag.ToString().ToLower()) { }
private static HtmlTag asTag(this HtmlTextWriterTag tag) { return(new HtmlTag(tag.ToString())); }
public DomQueryBuilder Tag(HtmlTextWriterTag tag) { return Tag(tag.ToString().ToLowerInvariant()); }
public static string Write(this HtmlTextWriterTag tag) { Enumeration.AssertDefined <HtmlTextWriterTag>(tag); return(tag.ToString().ToLowerInvariant()); }
public static ISgmlWriter Element(this ISgmlWriter writer, HtmlTextWriterTag name, object value) { writer.Element(name.ToString(), value); return writer; }
/// <summary> /// Initializes a new instance of the WebControl class using the specified HTML tag. /// </summary> /// <param name="tag"></param> public WebControl(HtmlTextWriterTag tag) { TagName = tag.ToString().ToLower(); }