Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
TextView Class
Collapse the table of content
Expand the table of content

TextView Class

.NET Framework 1.1

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

public class System.Web.UI.MobileControls.TextView : 


Just as with a Label control, you can address and program the TextView control. The format of text in a TextView control is identical to the format of text in the literal text of a form. However, unlike literal text on a form, you can set the text in a TextView control at run time. You can declaratively set the text of a TextView control in two ways, either through the persistence format (Text="Text") or, programmatically, by using the Text property.

You can include literal text and its accompanying markup tags in the text contents of the TextView control. See Literal Text Inside Form Markup for more information.

Whether your TextView object is contained by a panel or by a form, set the Paginate property on the Form or Panel object to true to avoid the possibility of problems when there is more text than a mobile device can handle. For more information, see Pagination.


This example demonstrates how to create an instance of the TextView class, modify its properties, and add it as a child control to a form.

<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" 
   Language="VB" %>
<%@ Register TagPrefix="mobile"
    Assembly="System.Web.Mobile" %>

<script runat="server" language="vb">      

' Create the control dynamically
Dim TextView1 As New TextView

Public Sub Page_Load(sender As Object, e As EventArgs)
   TextView1.Text = "This was added in the page load."
   TextView1.StyleReference = "title"
   TextView1.ForeColor = System.Drawing.Color.Blue
End Sub

<mobile:Form id="Form1" runat="server" />
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" 
   Language="c#" %>
<%@ Register TagPrefix="mobile"
    Assembly="System.Web.Mobile" %>

<script runat="server" language="c#">      

// Create the control dynamically
TextView TextView1 = new TextView();

public void Page_Load(Object sender, EventArgs e)
   TextView1.Text = "This was added in the page load.";
   TextView1.StyleReference = "title";
   TextView1.ForeColor = System.Drawing.Color.Blue;

<mobile:Form id="Form1" runat="server" />


Namespace: System.Web.UI.MobileControls

Assembly: System.Web.Mobile

See Also

Form | Panel

© 2015 Microsoft