DekGenius.com
[ Team LiB ] Previous Section Next Section

HtmlTextWritermarshal by reference, disposable

System.Web.UI (system.web.dll)class

The ASP.NET framework uses this class when writing the client-side HTML for a Web Forms page. It contains a wealth of methods for rendering the appropriate content, and derives from the more generic System.IO.TextWriter. Typically, you will not use this class directly in your code, unless you are a control developer.

When deriving custom controls from Control or System.Web.UI.WebControls.WebControl, you can override the Render( ) or RenderContents( ) method and create the control's output by using the supplied HtmlTextWriter. Commonly used methods include Write( ), which can output text or HTML tags, AddStyleAttribute( ), which specifies a CSS style attribute for the next tag, and RenderBeginTag( ) and RenderEndTag( ), which make it easy to insert open and closing HTML tags while keeping the code readable. The HtmlTextWriter also performs automatic indentation of the HTML output.

public class HtmlTextWriter : System.IO.TextWriter {
// Public Constructors
   public HtmlTextWriter(System.IO.TextWriter writer);
   public HtmlTextWriter(System.IO.TextWriter writer, string tabString);
// Public Static Fields
   public const string DefaultTabString;            // = 
   public const char DoubleQuoteChar;               // =0x00000022
   public const string EndTagLeftChars;             // =</
   public const char EqualsChar;                    // =0x0000003D
   public const string EqualsDoubleQuoteString;     // =  ="
   public const string SelfClosingChars;            // = /
   public const string SelfClosingTagEnd;           // = />
   public const char SemicolonChar;                 // =0x0000003B
   public const char SingleQuoteChar;               // =0x00000027
   public const char SlashChar;                     // =0x0000002F
   public const char SpaceChar;                     // =0x00000020
   public const char StyleEqualsChar;               // =0x0000003A
   public const char TagLeftChar;                   // =0x0000003C
   public const char TagRightChar;                  // =0x0000003E
// Public Instance Properties
   public override Encoding Encoding{get; }         // overrides System.IO.TextWriter
   public int Indent{set; get; }
   public TextWriter InnerWriter{set; get; }
   public override string NewLine{set; get; }       // overrides System.IO.TextWriter
// Protected Instance Properties
   protected HtmlTextWriterTag TagKey{set; get; }
   protected string TagName{set; get; }
// Protected Static Methods
   protected static void RegisterAttribute(string name, HtmlTextWriterAttribute key);
   protected static void RegisterStyle(string name, HtmlTextWriterStyle key);
   protected static void RegisterTag(string name, HtmlTextWriterTag key);
// Public Instance Methods
   public virtual void AddAttribute(HtmlTextWriterAttribute key, string value);
   public virtual void AddAttribute(HtmlTextWriterAttribute key, string value, bool fEncode);
   public virtual void AddAttribute(string name, string value);
   public virtual void AddAttribute(string name, string value, bool fEndode);
   public virtual void AddStyleAttribute(HtmlTextWriterStyle key, string value);
   public virtual void AddStyleAttribute(string name, string value);
   public override void Close( );                    // overrides System.IO.TextWriter
   public override void Flush( );                    // overrides System.IO.TextWriter
   public virtual void RenderBeginTag(HtmlTextWriterTag tagKey);
   public virtual void RenderBeginTag(string tagName);
   public virtual void RenderEndTag( );
   public override void Write(bool value);         // overrides System.IO.TextWriter
   public override void Write(char value);         // overrides System.IO.TextWriter
   public override void Write(char[ ] buffer); // overrides System.IO.TextWriter
   public override void Write(char[ ] buffer, int index, // overrides System.IO.TextWriterint count);
   public override void Write(double value);       // overrides System.IO.TextWriter
   public override void Write(int value);          // overrides System.IO.TextWriter
   public override void Write(long value);         // overrides System.IO.TextWriter
   public override void Write(object value);       // overrides System.IO.TextWriter
   public override void Write(float value);        // overrides System.IO.TextWriter
   public override void Write(string s);           // overrides System.IO.TextWriter
   public override void Write(string format, object arg0); // overrides System.IO.TextWriter
   public override void Write(string format, params object[ ] arg); // overrides System.IO.TextWriter
   public override void Write(string format, object arg0, object arg1); // overrides System.IO.TextWriter
   public virtual void WriteAttribute(string name, string value);
   public virtual void WriteAttribute(string name, string value, bool fEncode);
   public virtual void WriteBeginTag(string tagName);
   public virtual void WriteEndTag(string tagName);
   public virtual void WriteFullBeginTag(string tagName);
   public override void WriteLine( );                // overrides System.IO.TextWriter
   public override void WriteLine(bool value);                  // overrides System.IO.TextWriter
   public override void WriteLine(char value);                  // overrides System.IO.TextWriter
   public override void WriteLine(char[ ] buffer);               // overrides System.IO.TextWriter
   public override void WriteLine(char[ ] buffer, int index, int count); // overrides System.IO.TextWriter
   public override void WriteLine(double value);                // overrides System.IO.TextWriter
   public override void WriteLine(int value);                   // overrides System.IO.TextWriter
   public override void WriteLine(long value);                  // overrides System.IO.TextWriter
   public override void WriteLine(object value);                // overrides System.IO.TextWriter
   public override void WriteLine(float value);                 // overrides System.IO.TextWriter
   public override void WriteLine(string s);       // overrides System.IO.TextWriter
   public override void WriteLine(string format, object arg0);// overrides System.IO.TextWriter
   public override void WriteLine(string format, params object[ ] arg);  // overrides System.IO.TextWriter
   public override void WriteLine(string format, object arg0, object arg1);// overrides System.IO.TextWriter
   public override void WriteLine(uint value);                  // overrides System.IO.TextWriter
   public void WriteLineNoTabs(string s);
   public virtual void WriteStyleAttribute(string name, string value);
   public virtual void WriteStyleAttribute(string name, string value, bool fEncode);
// Protected Instance Methods
   protected virtual void AddAttribute(string name, string value, HtmlTextWriterAttribute key);
   protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key);
   protected virtual string EncodeAttributeValue(HtmlTextWriterAttribute attrKey, string value);
   protected string EncodeAttributeValue(string value, bool fEncode);
   protected string EncodeUrl(string url);
   protected virtual void FilterAttributes( );
   protected HtmlTextWriterAttribute GetAttributeKey(string attrName);
   protected string GetAttributeName(HtmlTextWriterAttribute attrKey);
   protected HtmlTextWriterStyle GetStyleKey(string styleName);
   protected string GetStyleName(HtmlTextWriterStyle styleKey);
   protected virtual HtmlTextWriterTag GetTagKey(string tagName);
   protected virtual string GetTagName(HtmlTextWriterTag tagKey);
   protected bool IsAttributeDefined(HtmlTextWriterAttribute key);
   protected bool IsAttributeDefined(HtmlTextWriterAttribute key, out string value);
   protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key);
   protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key, out string value);
   protected virtual bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key);
   protected virtual bool OnStyleAttributeRender(string name, string value, HtmlTextWriterStyle key);
   protected virtual bool OnTagRender(string name, HtmlTextWriterTag key);
   protected virtual void OutputTabs( );
   protected string PopEndTag( );
   protected void PushEndTag(string endTag);
   protected virtual string RenderAfterContent( );
   protected virtual string RenderAfterTag( );
   protected virtual string RenderBeforeContent( );
   protected virtual string RenderBeforeTag( );
}

Hierarchy

System.Object System.MarshalByRefObject System.IO.TextWriter(System.IDisposable) HtmlTextWriter

Subclasses

Html32TextWriter, System.Web.UI.MobileControls.Adapters.MultiPartWriter

Returned By

System.Web.UI.MobileControls.Adapters.HtmlPageAdapter.CreateTextWriter( ), System.Web.UI.MobileControls.Adapters.WmlPageAdapter.CreateTextWriter( ), System.Web.UI.MobileControls.IPageAdapter.CreateTextWriter( ), Page.CreateHtmlTextWriter( )

Passed To

Multiple types

    [ Team LiB ] Previous Section Next Section