Export (0) Print
Expand All
Expand Minimize

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 : 
   System.Web.UI.MobileControls.PagedControl

Remarks

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.

Example

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"
    Namespace="System.Web.UI.MobileControls"
    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
   Form1.Controls.Add(TextView1)
End Sub
</script>

<mobile:Form id="Form1" runat="server" />
[C#]
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" 
   Language="c#" %>
<%@ Register TagPrefix="mobile"
    Namespace="System.Web.UI.MobileControls"
    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;
   Form1.Controls.Add(TextView1);
}
</script>

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

Requirements

Namespace: System.Web.UI.MobileControls

Assembly: System.Web.Mobile

See Also

Form | Panel

Show:
© 2014 Microsoft