Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
NewLine Property

HtmlTextWriter.NewLine Property

Gets or sets the line terminator string used by the HtmlTextWriter object.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

abstract NewLine : string with get, set 
override NewLine : string with get, set

Property Value

Type: System.String
The line terminator string used by the current HtmlTextWriter.

The default line terminator string is a carriage return, followed by a line feed ("\r\n").

The line terminator string is written to the output stream whenever one of the WriteLine methods is called. If the NewLine property is set to a null reference (Nothing in Visual Basic), the default new line character is used.

The following code example shows how to use a custom class, derived from the HtmlTextWriter class, that overrides the FilterAttributes method. When called, the FilterAttributes override checks whether the text writer renders any <label> or <a> elements. If so, the FilterAttributes method determines whether a style attribute is defined for the label. If no style is defined, the FilterAttributes method sets the default value for the style:color attribute to blue. The FilterAttributes method then uses the NewLine property to insert a line break in the markup tag and writes any other defined attributes.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
Show:
© 2015 Microsoft