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
	Inherits ITextControl

NameDescription
System_CAPS_pubpropertyText

Gets or sets the text content of a control.(Inherited from ITextControl.)

NameDescription
System_CAPS_pubeventTextChanged

Occurs when the content of the text changes between posts to the server.

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 Class customeditablebox
    Inherits System.Web.UI.UserControl
    Implements System.Web.UI.IEditableTextControl

    Private Shared ReadOnly EventCustomTextChanged As New Object

    Public Custom Event TextChanged As EventHandler _
      Implements System.Web.UI.IEditableTextControl.TextChanged
        AddHandler(ByVal value As EventHandler)
            Events.AddHandler(EventCustomTextChanged, value)
        End AddHandler

        RemoveHandler(ByVal value As EventHandler)
            Events.RemoveHandler(EventCustomTextChanged, value)
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As EventArgs)

        End RaiseEvent
    End Event

    Public Property Text() As String _
      Implements System.Web.UI.IEditableTextControl.Text
        Get
            ' Provide implementation.
            Return String.Empty
        End Get
        Set(ByVal value As String)
            ' Provide implementation.
        End Set
    End Property
End Class

.NET Framework
Available since 2.0
Return to top
Show: