Export (0) Print
Expand All

IEditableTextControl Interface

Represents a control that renders text that can be changed by the user.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public interface IEditableTextControl : ITextControl

The IEditableTextControl type exposes the following members.

  NameDescription
Public propertyTextGets or sets the text content of a control. (Inherited from ITextControl.)
Top

  NameDescription
Public eventTextChangedOccurs when the content of the text changes between posts to the server.
Top

Controls, such as TextBox and those that derive from ListControl, provide a text property that can be changed by a page user. When the text property is changed, an event is raised to notify handlers that the property has changed. Classes that implement IEditableTextControl must define the TextChanged event.

Although the IEditableTextControl interface contains only the TextChanged event, it inherits from the ITextControl interface, which defines a Text property. To implement the IEditableTextControl interface, a control must define the Text property and the TextChanged event that occurs when the Text property changes between posts to the server.

IEditableTextControl is implemented by TextBox and ListControl. In those classes, the event is raised through the ListControl.OnTextChanged or TextBox.OnTextChanged methods. A class that implements the IEditableTextControl interface could define a similar method for raising the event.

The following code example shows an implementation of the TextChanged event.


public partial class customeditablebox : System.Web.UI.UserControl, IEditableTextControl
{
    private static readonly object EventCustomTextChanged = new Object();

    public event EventHandler TextChanged
    {
        add
        {
            Events.AddHandler(EventCustomTextChanged, value);
        }
        remove
        {
            Events.RemoveHandler(EventCustomTextChanged, value);
        }
    }

    public string Text
    {
        get
        {
            // Provide implementation. 
            return String.Empty;
        }
        set
        {
            // Provide implementation.
        }
    }
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft