This documentation is archived and is not being maintained.

TextBox.TextChanged Event

Occurs when the user changes the text of a TextBox.

Namespace: System.Web.UI.MobileControls
Assembly: System.Web.Mobile (in

public event EventHandler TextChanged
/** @event */
public void add_TextChanged (EventHandler value)

/** @event */
public void remove_TextChanged (EventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

When the user changes the text of a TextBox, this event is not raised immediately. The form must contain a Command to initiate a postback event that raises the TextChanged event.

The following example demonstrates how to use the TextChanged event to change the items in a SelectionList.

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

<script runat="server">
    void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            // Add items to the list
                MobileListItem("Verify transactions","Done"));
                MobileListItem("Check balance sheet","Scheduled"));
                MobileListItem("Call customer", "Done"));
                MobileListItem("Send checks", "Pending"));
                MobileListItem("Send report", "Pending"));
                MobileListItem("Attend meeting", "Scheduled"));

            // Show all items in list
            SelectionList1.Rows = SelectionList1.Items.Count;
    void TextChanged(object sender, EventArgs e)
        // Called during PostBack, if changed
        string task = TextBox1.Text;
        string status = TextBox2.Text;
        if (task.Length > 0 && status.Length > 0)

            MobileListItem li = new MobileListItem(task, status);
            // Remove the item if it exists
            if (SelectionList1.Items.Contains(li))
                // Add the item if it does not exist

            // Clear the text boxes
            TextBox1.Text = String.Empty;
            TextBox2.Text = String.Empty;

        // Display all items.
        SelectionList1.Rows = SelectionList1.Items.Count;

<html xmlns="" >
    <mobile:Form id="Form1" runat="server">
        <mobile:Label Id="Label1" runat="server">
            Create a new Task with Status</mobile:Label>   
        <mobile:SelectionList runat="server" BreakAfter="true" 
            id="SelectionList1" />
        <mobile:Label Id="Label2" runat="server" 
            Text="Enter the Task name" />
        <mobile:TextBox runat="server" id="TextBox1" 
            OnTextChanged="TextChanged" />
        <mobile:Label Id="Label3" runat="server" 
            Text="Enter the Task status" />
        <mobile:TextBox runat="server" id="TextBox2" />
        <mobile:Command ID="Command1" runat="server" 
            Text="Submit" />

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1