HtmlTextArea.ServerChange イベントとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlTextArea.ServerChange イベントの意味・解説 

HtmlTextArea.ServerChange イベント

HtmlTextArea コントロール内容サーバーへのポスト間で変更され場合発生します

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

Dim instance As HtmlTextArea
Dim handler As EventHandler

AddHandler instance.ServerChange, handler
/** @event */
public void add_ServerChange (EventHandler
 value)

/** @event */
public void remove_ServerChange (EventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

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

<%@ 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 名前空間
OnServerChange
System.EventHandler
その他の技術情報
HTML サーバー コントロール


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

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

辞書ショートカット

すべての辞書の索引

「HtmlTextArea.ServerChange イベント」の関連用語

HtmlTextArea.ServerChange イベントのお隣キーワード
検索ランキング

   

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



HtmlTextArea.ServerChange イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS