本文整理汇总了C#中System.Web.UI.HtmlTextWriter.Write方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.Write方法的具体用法?C# HtmlTextWriter.Write怎么用?C# HtmlTextWriter.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.Write方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
// Create a manually rendered <img> element
// that contains an alt attribute.
writer.WriteBeginTag("img");
writer.WriteAttribute("alt", "A custom image.");
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag("img");
示例2:
// Render a character array as the
// contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write(testChars);
writer.RenderEndTag();
示例3:
// Use the Write(Double) method to render
// the MaxValue field of the Double structure.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write(Double.MaxValue);
writer.RenderEndTag();
示例4:
// Use the Write method to render an arbitrary
// object, in this case a CultureInfo object.
writer.Write("This is a rendered CultureInfo Object.");
writer.RenderBeginTag(HtmlTextWriterTag.B);
writer.Write(CultureInfo.CurrentCulture);
writer.RenderEndTag();
示例5:
// Use the Write(Single) method to render the
// Epsilon field of the Single structure.
writer.RenderBeginTag(HtmlTextWriterTag.B);
writer.Write(Single.Epsilon);
writer.RenderEndTag();
示例6:
// Create a non-standard tag.
writer.RenderBeginTag("MyTag");
writer.Write("Contents of MyTag");
writer.RenderEndTag();
writer.WriteLine();
示例7:
// Use the Write(string, object) method to
// render a formatted string and an object in it.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write("The current cultural settings are {0}",
CultureInfo.CurrentCulture);
writer.RenderEndTag();
示例8:
// Render a formatted string and the
// text representation of an object array,
// myObjectArray, as the contents of
// a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write("The trade value at {1} is ${0}.", curPriceTime);
writer.RenderEndTag();
示例9:
// Render a subarray of a character array
// as the contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write(testChars, 0, 5);
writer.RenderEndTag();
示例10:
// Use the Write(string,object,object) method to
// render a formatted string and two objects
// in the string.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write("The current cultural settings are {0}. Today's date is {1}.",
CultureInfo.CurrentCulture, DateTime.Today);
writer.RenderEndTag();