本文整理汇总了C#中HtmlTextWriterTag.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriterTag.ToString方法的具体用法?C# HtmlTextWriterTag.ToString怎么用?C# HtmlTextWriterTag.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTextWriterTag
的用法示例。
在下文中一共展示了HtmlTextWriterTag.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertText
/// <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;
}
示例2: BuildOneTag
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);
}
示例3: HtmlTag
/// <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();
}
示例4: GetTagName
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:
//.........这里部分代码省略.........
示例5: GetTagName
private String GetTagName(HtmlTextWriterTag key)
{
String name = key.ToString().ToLower();
if (name.Contains(".")) name = name.Substring(name.LastIndexOf(".") + 1);
return name;
}
示例6: Tag
public DomQueryBuilder Tag(HtmlTextWriterTag tag)
{
return Tag(tag.ToString().ToLowerInvariant());
}
示例7: Element
public static ISgmlWriter Element(this ISgmlWriter writer, HtmlTextWriterTag name, object value)
{
writer.Element(name.ToString(), value);
return writer;
}