HtmlTextArea.OnServerChange メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlTextArea.OnServerChange メソッドの意味・解説 

HtmlTextArea.OnServerChange メソッド

HtmlTextArea コントロールの ServerChange イベント発生させます。この機能により、イベントカスタム ハンドラ作成できます

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

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

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

パラメータ

e

イベント データ格納している System.EventArgs。

解説解説
使用例使用例

ServerChange イベントカスタム イベント ハンドラ指定および作成する方法次のコード例示しますHtmlTextArea コントロール入力された値が 20 文字超えると、メッセージ表示されます。

<%@ Page Language="VB" AutoEventWireup="True"
 %>

<script runat="server">

  Sub Server_Change(ByVal sender As
 Object, ByVal e As EventArgs)
         
    ' The ServerChange event is commonly used for data validation.
    ' This method determines whether the comment entered into the
    ' HtmlTextArea control is longer than 20 characters.
    If TextArea1.Value.Length > 20 Then
      Span1.InnerHtml = "Your comment cannot exceed 20 characters."
    Else
      Span1.InnerHtml = "You wrote: <br>" +
 TextArea1.Value
    End If
      
  End Sub

</script>

<html>
<head>
   <title>HtmlTextArea ServerChange Example</title>

</head>
<body>

   <form runat="server">

      <h3>HtmlTextArea ServerChange Example</h3>

      Enter your comments: <br>

      <textarea id="TextArea1"
                OnServerChange="Server_Change" 
                runat="server"/>

      <br>

      <input type="submit"  
             value="Submit" 
             runat="server"/>

      <p>

      <span id="Span1" 
            runat="server" />

   </form>

</body>
</html>
<%@ Page Language="C#" AutoEventWireup="True" %>

<script runat="server">

  void Server_Change(Object sender, EventArgs e)
  {

    // The ServerChange event is commonly used for data validation.
    // This method determines whether the comment entered into the
    // HtmlTextArea control is longer than 20 characters.
    if (TextArea1.Value.Length > 20)
      Span1.InnerHtml = "Your comment cannot exceed 20 characters.";
    else
      Span1.InnerHtml = "You wrote: <br>" + TextArea1.Value;

  }

</script>

<html>
<head>
   <title>HtmlTextArea ServerChange Example</title>
</head>
<body>

   <form runat="server">

      <h3>HtmlTextArea ServerChange Example</h3>

      Enter your comments: <br>

      <textarea id="TextArea1"
                onserverchange="Server_Change" 
                runat="server"/>

      <br>

      <input type="submit"  
             value="Submit" 
             runat="server"/>

      <p>

      <span id="Span1" 
            runat="server" />

   </form>

</body>
</html>
<%@ Page Language="JScript" AutoEventWireup="True" %>

<script runat="server">

  function Server_Change(sender, e : EventArgs)
  { 
         
    // The ServerChange event is commonly used for data validation.
    // This method determines whether the comment entered into the
    // HtmlTextArea control is longer than 20 characters.
    if (TextArea1.Value.Length > 20)
       Span1.InnerHtml = "Your comment cannot exceed 20 characters.";
    else
       Span1.InnerHtml = "You wrote: <br>" + TextArea1.Value;
      
  }

</script>

<html>
<head>
   <title>HtmlTextArea ServerChange Example</title>

</head>
<body>

   <form runat="server">

      <h3>HtmlTextArea ServerChange Example</h3>

      Enter your comments: <br>

      <textarea id="TextArea1"
                onserverchange="Server_Change" 
                runat="server"/>

      <br>

      <input type="submit"  
             value="Submit" 
             runat="server"/>

      <p>

      <span id="Span1" 
            runat="server" />

   </form>

</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True"
 %>

<script runat="server">

  Sub Server_Change(ByVal sender As
 Object, ByVal e As EventArgs)
     
    ' The ServerChange event is commonly used for data validation.
    ' This method determines whether the comment entered into the
    ' HtmlTextArea control is longer than 20 characters.
    If TextArea1.Value.Length > 20 Then
         
      Span1.InnerHtml = "Your comment cannot exceed 20 characters."
         
    Else
         
      Span1.InnerHtml = "You wrote: <br>" +
 TextArea1.Value
         
    End If
      
  End Sub

  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)

    ' Create an EventHandler delegate for the method you want to 
    ' handle the event, and then add it to the list of methods
    ' called when the event is raised.
    AddHandler TextArea1.ServerChange, AddressOf
 Server_Change

  End Sub

</script>

<html>
<head>
   <title>HtmlTextArea ServerChange Example</title>
</head>

<body>

   <form runat="server">

      <h3>HtmlTextArea ServerChange Example</h3>

      Enter your comments (20 or fewer characters): <br>

      <textarea id="TextArea1"
                runat="server"/>

      <br>

      <input type="submit"  
             value="Submit" 
             runat="server"/>

      <p>

      <span id="Span1" 
            runat="server" />

   </form>

</body>
</html>

<%@ Page Language="C#" AutoEventWireup="True" %>

<script runat="server">

  void Server_Change(Object sender, EventArgs e)
  {
    // The ServerChange event is commonly used for data validation.
    // This method determines whether the comment entered into the
    // HtmlTextArea control is longer than 20 characters.
    if (TextArea1.Value.Length > 20)
    {
      Span1.InnerHtml = "Your comment cannot exceed 20 characters.";
    }
    else
    {
      Span1.InnerHtml = "You wrote: <br>" + TextArea1.Value;
    }

  }

  void Page_Load(Object sender, EventArgs e)
  {

    // Create an EventHandler delegate for the method you want to
    // handle the event, and then add it to the list of methods
    // called when the event is raised.
    TextArea1.ServerChange +=
      new System.EventHandler(this.Server_Change);

  }

</script>

<html>
<head>
   <title>HtmlTextArea ServerChange Example</title>
</head>
<body>

   <form runat="server">

      <h3>HtmlTextArea ServerChange Example</h3>

      Enter your comments (20 or fewer characters): <br>

      <textarea id="TextArea1"
                runat="server"/>

      <br>

      <input type="submit"  
             value="Submit" 
             runat="server"/>

      <p>

      <span id="Span1" 
            runat="server" />

   </form>

</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlTextArea クラス
HtmlTextArea メンバ
System.Web.UI.HtmlControls 名前空間
ServerChange
System.EventArgs
その他の技術情報
HTML サーバー コントロール


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

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

辞書ショートカット

すべての辞書の索引

HtmlTextArea.OnServerChange メソッドのお隣キーワード
検索ランキング

   

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



HtmlTextArea.OnServerChange メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS