TextBox.OnTextChangedとは? わかりやすく解説

TextBox.OnTextChanged メソッド

ユーザーテキスト ボックス内のテキスト変更し変更内容サーバー送信されたときに呼び出されます。

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

Protected Overridable Sub
 OnTextChanged ( _
    e As EventArgs _
)
Dim e As EventArgs

Me.OnTextChanged(e)
protected virtual void OnTextChanged (
    EventArgs e
)
protected:
virtual void OnTextChanged (
    EventArgs^ e
)
protected void OnTextChanged (
    EventArgs e
)
protected function OnTextChanged (
    e : EventArgs
)

パラメータ

e

イベント データ格納している EventArgs オブジェクト

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

TextBox.OnTextChanged メソッド

TextChanged イベント発生させます。これにより、イベント直接処理できます

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Overridable Sub
 OnTextChanged ( _
    e As EventArgs _
)
Dim e As EventArgs

Me.OnTextChanged(e)
protected virtual void OnTextChanged (
    EventArgs e
)
protected:
virtual void OnTextChanged (
    EventArgs^ e
)
protected void OnTextChanged (
    EventArgs e
)
protected function OnTextChanged (
    e : EventArgs
)

パラメータ

e

イベント情報格納する EventArgs。

解説解説
使用例使用例

OnTextChanged メソッドオーバーライドして、TextBox カスタム サーバー コントロールを常に変更済みとして表示する方法次のコード例示します

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page Language="VB" AutoEventWireup="True"
 %>
<HTML>
    <HEAD>
        <title>Custom TextBox - OnTextChanged - VB.NET Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post"
 runat="server">
            <h3>Custom TextBox - OnTextChanged - VB.NET Example</h3>
            
            <aspSample:CustomTextBoxOnTextChanged id="TextBox1"
 autopostback=true
             runat="server">Hello World!</aspSample:CustomTextBoxOnTextChanged>
        </form>
    </body>
</HTML>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom TextBox - OnTextChanged - C# Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom TextBox - OnTextChanged - C# Example</h3>
            
            <aspSample:CustomTextBoxOnTextChanged 
              id="TextBox1" 
              autopostback=true
              runat="server">Hello World!
            </aspSample:CustomTextBoxOnTextChanged>
            
        </form>
    </body>
</HTML>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom TextBox - OnTextChanged - VJ# Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom TextBox - OnTextChanged - VJ# Example</h3>
            
            <aspSample:CustomTextBoxOnTextChanged 
              id="TextBox1" 
              autopostback=true
              runat="server"
              text="Hello World!">
            </aspSample:CustomTextBoxOnTextChanged>
            
        </form>
    </body>
</HTML>
Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
    Public NotInheritable Class
 CustomTextBoxOnTextChanged
        Inherits System.Web.UI.WebControls.TextBox

        Private isDirty As Boolean
 = False

        Protected Overrides Sub
 OnTextChanged(ByVal e As System.EventArgs)

            ' Call the base OnTextChanged method.
            MyBase.OnTextChanged(e)

            ' Change the dirty flag to True.
            isDirty = True
        End Sub
    End Class
End Namespace
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
  [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)]
  public sealed class CustomTextBoxOnTextChanged
 : System.Web.UI.WebControls.TextBox
  {
    private bool isDirty = false;

    protected override void OnTextChanged(System.EventArgs
 e)
    {
      // Call the base OnTextChanged method.
      base.OnTextChanged(e);

      // Change the dirty flag to True.
      isDirty = true;
    }
  }
}
package Samples.AspNet.JSL.Controls; 

public class CustomTextBoxOnTextChanged
    extends System.Web.UI.WebControls.TextBox
{
    private boolean isDirty = false;

    protected void OnTextChanged(System.EventArgs
 e)
    {
        // Call the base OnTextChanged method.
        super.OnTextChanged(e);
        // Change the dirty flag to True.
        isDirty = true;
    } //OnTextChanged
} //CustomTextBoxOnTextChanged
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からTextBox.OnTextChangedを検索した結果を表示しています。
Weblioに収録されているすべての辞書からTextBox.OnTextChangedを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からTextBox.OnTextChanged を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「TextBox.OnTextChanged」の関連用語

TextBox.OnTextChangedのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TextBox.OnTextChangedのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS