TextBox.AutoPostBack プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TextBox.AutoPostBack プロパティの意味・解説 

TextBox.AutoPostBack プロパティ

ユーザーTextBox コントロール内で Enter キーまたは Tab キー押した場合に必ずサーバーへの自動ポストバック発生するかどうかを示す値を取得または設定します

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

解説解説
使用例使用例

AutoPostBack プロパティ使用してユーザーEnter キーまたは Tab キー押したときに、テキスト ボックス入力された値の合計自動的に表示する方法次のコード例示します

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

<html> 

<head>

   <script runat="server">

      Protected Sub Page_Load(sender As
 Object, e As EventArgs)
    
         Dim Answer As Integer

         ' Due to a timing issue with when page validation occurs, call
 the
         ' Validate method to ensure that the values on the page are
 valid.
         Page.Validate()

         ' Add the values in the text boxes if the page is valid.
         If Page.IsValid Then
 
            Answer = Convert.ToInt32(Value1.Text) + Convert.ToInt32(Value2.Text)

            AnswerMessage.Text = Answer.ToString()

         End If

      End Sub

   </script>

</head>

<body>

   <form runat="server">

      <h3> TextBox Example </h3>

      <table>

         <tr>

            <td colspan="5">

               Enter integer values into the text boxes. <br>
               The two values are automatically added <br>
               when you tab out of the text
 boxes. <br>

            </td>

         </tr>

         <tr>

            <td colspan="5">

               &nbsp;

            </td>

         </tr>

         <tr align="center">

            <td>

               <asp:TextBox ID="Value1"
                    Columns="2"
                    MaxLength="3"
                    AutoPostBack="True"
                    Text="1"
                    runat="server"/>

            </td>

            <td>

               + 

            </td>

            <td>

               <asp:TextBox ID="Value2"
                    Columns="2"
                    MaxLength="3"
                    AutoPostBack="True"
                    Text="1"
                    runat="server"/>

            </td>

            <td>

               =

            </td>

            <td>
               
               <asp:Label ID="AnswerMessage"
                    runat="server"/>

            </td>

         </tr>

         <tr>

            <td colspan="2">

               <asp:RequiredFieldValidator
                    ID="Value1RequiredValidator"
                    ControlToValidate="Value1"
                    ErrorMessage="Please enter a value.<br>"
                    EnableClientScript="False"
                    Display="Dynamic"
                    runat="server"/>

               <asp:RangeValidator
                    ID="Value1RangeValidator"
                    ControlToValidate="Value1"
                    Type="Integer"
                    MinimumValue="1"
                    MaximumValue="100"
                    ErrorMessage="Please enter an integer <br>
 between than 1 and 100.<br>"
                    EnableClientScript="False"
                    Display="Dynamic"
                    runat="server"/>

            </td>

            <td colspan="2">

               <asp:RequiredFieldValidator
                    ID="Value2RequiredValidator"
                    ControlToValidate="Value2"
                    ErrorMessage="Please enter a value.<br>"
                    EnableClientScript="False"
                    Display="Dynamic"
                    runat="server"/>

               <asp:RangeValidator
                    ID="Value2RangeValidator"
                    ControlToValidate="Value2"
                    Type="Integer"
                    MinimumValue="1"
                    MaximumValue="100"
                    ErrorMessage="Please enter an integer <br>
 between than 1 and 100.<br>"
                    EnableClientScript="False"
                    Display="Dynamic"
                    runat="server"/>

            </td>

            <td>

               &nbsp
 
            </td

         </tr>

      </table>

   </form>

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

<html> 

<head>

   <script runat="server">

      protected void Page_Load(Object sender,
 EventArgs e)
      {
         int Answer;

         // Due to a timing issue with when page validation occurs,
 call the
         // Validate method to ensure that the values on the page are
 valid.
         Page.Validate();

         // Add the values in the text boxes if the page is valid.
         if(Page.IsValid)
         {
            Answer = Convert.ToInt32(Value1.Text) + Convert.ToInt32(Value2.Text);

            AnswerMessage.Text = Answer.ToString();
         }

      }

   </script>

</head>

<body>

   <form runat="server">

      <h3> TextBox Example </h3>

      <table>

         <tr>

            <td colspan="5">

               Enter integer values into the text boxes. <br>
               The two values are automatically added <br>
               when you tab out of the text boxes. <br>

            </td>

         </tr>

         <tr>

            <td colspan="5">

               &nbsp;

            </td>

         </tr>

         <tr align="center">

            <td>

               <asp:TextBox ID="Value1"
                    Columns="2"
                    MaxLength="3"
                    AutoPostBack="True"
                    Text="1"
                    runat="server"/>

            </td>

            <td>

               + 

            </td>

            <td>

               <asp:TextBox ID="Value2"
                    Columns="2"
                    MaxLength="3"
                    AutoPostBack="True"
                    Text="1"
                    runat="server"/>

            </td>

            <td>

               =

            </td>

            <td>
               
               <asp:Label ID="AnswerMessage"
                    runat="server"/>

            </td>

         </tr>

         <tr>

            <td colspan="2">

               <asp:RequiredFieldValidator
                    ID="Value1RequiredValidator"
                    ControlToValidate="Value1"
                    ErrorMessage="Please enter a value.<br>"
                    EnableClientScript="False"
                    Display="Dynamic"
                    runat="server"/>

               <asp:RangeValidator
                    ID="Value1RangeValidator"
                    ControlToValidate="Value1"
                    Type="Integer"
                    MinimumValue="1"
                    MaximumValue="100"
                    ErrorMessage="Please enter an integer <br> between
 than 1 and 100.<br>"
                    EnableClientScript="False"
                    Display="Dynamic"
                    runat="server"/>

            </td>

            <td colspan="2">

               <asp:RequiredFieldValidator
                    ID="Value2RequiredValidator"
                    ControlToValidate="Value2"
                    ErrorMessage="Please enter a value.<br>"
                    EnableClientScript="False"
                    Display="Dynamic"
                    runat="server"/>

               <asp:RangeValidator
                    ID="Value2RangeValidator"
                    ControlToValidate="Value2"
                    Type="Integer"
                    MinimumValue="1"
                    MaximumValue="100"
                    ErrorMessage="Please enter an integer <br> between
 than 1 and 100.<br>"
                    EnableClientScript="False"
                    Display="Dynamic"
                    runat="server"/>

            </td>

            <td>

               &nbsp
 
            </td

         </tr>

      </table>

   </form>

</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

TextBox.AutoPostBack プロパティのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS