IEditableTextControl 接口


表示一个控件,该控件呈现可由用户更改的文本。Represents a control that renders text that can be changed by the user.

public interface class IEditableTextControl : System::Web::UI::ITextControl
public interface IEditableTextControl : System.Web.UI.ITextControl
type IEditableTextControl = interface
    interface ITextControl
Public Interface IEditableTextControl
Implements ITextControl


下面的代码示例演示了该TextChanged事件的实现。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
            Events.AddHandler(EventCustomTextChanged, value);
            Events.RemoveHandler(EventCustomTextChanged, value);

    public string Text
            // Provide implementation.
            return String.Empty;
            // Provide implementation.
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
            ' Provide implementation.
            Return String.Empty
        End Get
        Set(ByVal value As String)
            ' Provide implementation.
        End Set
    End Property
End Class


控件 (如TextBox派生自ListControl的控件) 提供可由页面用户更改的文本属性。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. 实现IEditableTextControl的类必须TextChanged定义事件。Classes that implement IEditableTextControl must define the TextChanged event.

尽管接口只包含ITextControl事件,但它继承自接口, 该接口定义了一个Text属性。 TextChanged IEditableTextControlAlthough the IEditableTextControl interface contains only the TextChanged event, it inherits from the ITextControl interface, which defines a Text property. 若要实现IEditableTextControl接口, 控件必须Text定义属性以及TextChanged在向服务器的各次发送过程Text中的属性发生更改时发生的事件。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是由和TextBox ListControl实现的。IEditableTextControl is implemented by TextBox and ListControl. 在这些类中, 事件通过ListControl.OnTextChangedTextBox.OnTextChanged方法引发。In those classes, the event is raised through the ListControl.OnTextChanged or TextBox.OnTextChanged methods. 实现IEditableTextControl接口的类可以定义一个类似的方法来引发事件。A class that implements the IEditableTextControl interface could define a similar method for raising the event.



获取或设置控件的文本内容。Gets or sets the text content of a control.

(继承自 ITextControl)



当文本的内容在向服务器的发送操作之间更改时发生。Occurs when the content of the text changes between posts to the server.