TextView Class

Provides a programmable control for displaying larger amounts of text, with optional markup tags on a mobile page.

Namespace: System.Web.UI.MobileControls
Assembly: System.Web.Mobile (in system.web.mobile.dll)

public class TextView : PagedControl
public class TextView extends PagedControl
public class TextView extends PagedControl

Unlike literal text in a mobile form, you can set content of a TextView from code. Unlike a mobile Label control, you can include markup within the value of the Text property. Also, the TextView control is careful not to break up inserted elements such as links during pagination. For more information, see Literal Text Inside Form Markup.

If the TextView control is within a Panel, set the Panel.Paginate property to true to allow text to flow across multiple pages on mobile devices. If the TextView control is not in a Panel, put the name of the TextView control into the Form.ControlToPaginate property.

Most other properties and methods of the mobile TextView control are of more use to developers of new device adapters for rendering the contents on specific devices.

Caution noteCaution

This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. You can use validation controls to verify user input before displaying the input text in a control. ASP.NET provides an input request validation feature to block script and HTML in user input. For more information, see Securing Standard Controls, How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings, and Validating User Input in ASP.NET Web Pages.

The following code example creates numbers and identifies each prime number in a sentence, and adds those sentences to the TextView control. The example also uses custom pagination to provide only a page full of text at a time.


The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information, see ASP.NET Web Page Code Model.

  • AspNetHostingPermission  for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1

Community Additions