YouTip LogoYouTip

Prop Webcontrol Textbox Wrap

## ASP.NET TextBox Wrap Property The `Wrap` property is a member of the ASP.NET Web Server `TextBox` control. It is used to get or set whether the text content within a multi-line text box automatically wraps to the next line when it reaches the edge of the control. --- ## Definition and Usage * **Purpose:** Determines whether text wraps automatically within a multi-line text box. * **Prerequisite:** This property is only effective when the `TextMode` property of the `TextBox` control is set to `"MultiLine"`. * **Default Value:** The default value is `True` (text wraps automatically). --- ## Syntax ```xml ``` ### Property Values | Value | Description | | :--- | :--- | | **`True`** | **Default.** Text wraps automatically to the next line when it reaches the edge of the text box. | | **`False`** | Text does not wrap automatically. Users must press the Enter key to start a new line, or scroll horizontally to view long lines of text. | --- ## Code Examples ### Example 1: Disabling Text Wrapping The following example demonstrates how to set the `Wrap` property to `False` in an ASP.NET Web Forms page. This prevents the text from wrapping automatically. ```xml <%@ Page Language="C#" %> ASP.NET TextBox Wrap Example

TextBox with Wrap="False"

``` ### Example 2: Enabling Text Wrapping (Default Behavior) The following example demonstrates the default behavior where `Wrap` is set to `True`. ```xml <%@ Page Language="C#" %> ASP.NET TextBox Wrap Example

TextBox with Wrap="True"

``` --- ## Technical Considerations 1. **HTML Rendering:** When rendered to the browser, the ASP.NET `TextBox` with `TextMode="MultiLine"` translates into an HTML `