IEditableTextControl IEditableTextControl IEditableTextControl IEditableTextControl Interface

定義

表示會呈現使用者可變更之文字的控制項。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
    {
        add
        {
            Events.AddHandler(EventCustomTextChanged, value);
        }
        remove
        {
            Events.RemoveHandler(EventCustomTextChanged, value);
        }
    }

    public string Text
    {
        get
        {
            // Provide implementation.
            return String.Empty;
        }
        set
        {
            // 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
        Get
            ' 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. 當 text 屬性變更時, 會引發事件來通知處理常式屬性已變更。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.

雖然此IEditableTextControl TextChanged介面只包含事件ITextControl , 但它會繼承自訂Text屬性的介面。Although the IEditableTextControl interface contains only the TextChanged event, it inherits from the ITextControl interface, which defines a Text property. 若要執行IEditableTextControl介面, 控制項必須Text定義屬性和TextChanged事件, 而此屬性是在伺服器Text的 post 之間變更時所發生。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是由TextBoxListControl所執行。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.

事件

TextChanged TextChanged TextChanged TextChanged

發生於文字內容在公佈至伺服器期間時變更。Occurs when the content of the text changes between posts to the server.

屬性

Text Text Text Text

取得或設定控制項的文字內容。Gets or sets the text content of a control.

(Inherited from ITextControl)

適用於