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

ChtmlTextWriter::WriteBreak Method

Writes a br element to the cHTML output stream.

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

public:
virtual void WriteBreak() override

Use the WriteBreak method to insert a line break into a stream of cHMTL.

This section contains two code examples. The first code example demonstrates how to create a cHTML class and custom properties. The second code example demonstrates how to use a custom class on a Web page.

To use the custom ChtmlSimplelabelAdapter adapter, add the following code to either the appropriate machine-wide file in the subdirectory for the browser of the .NET Framework configuration directory or to a custom browser file in the App_Browsers directory under the Web application root.

<controlAdapters>
   <adapter controlType="AspNet.Samples.SimpleLabel"
   adapterType="AspNet.Samples.ChtmlSimpleLabelAdapter" />
</controlAdapters>

The following code example demonstrates how to create a cHTML adapter class named ChtmlSimpleLabelAdapter for a class named SimpleLabel. It creates a custom Control property that allows the ChtmlSimpleLabelAdapter class to access the members of the SimpleLabel class, and then overrides the Render method. In the override, the following things occur:

  • It creates a reference to a ChtmlTextWriter object, named w, which is derived from the HtmlTextWriter object that is passed as the writer parameter for the Render method.

  • It creates a string and sets it equal to the SimpleLabel.Text value.

  • It calls the EnterStyle method to apply the styles that are defined by the ControlStyle property of the label to the cHTML output stream.

  • It writes the Text property value to the stream and closes the style block by calling the ExitStyle method.

  • It calls the WriteBreak method to render a br element to the output stream after the text and styles render.

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

The following example demonstrates how to use the SimpleLabel class in a Web page.

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
Show:
© 2015 Microsoft