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

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

HtmlForm.DefaultFocus プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

HtmlForm コントロール読み込まれたときに入力フォーカスのあるコントロールとして表示するフォーム上のコントロール取得または設定します

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

Dim instance As HtmlForm
Dim value As String

value = instance.DefaultFocus

instance.DefaultFocus = value
public string DefaultFocus { get;
 set; }
public:
property String^ DefaultFocus {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_DefaultFocus ()

/** @property */
public void set_DefaultFocus (String value)
public function get DefaultFocus
 () : String

public function set DefaultFocus
 (value : String)

プロパティ
HtmlForm読み込まれたときに入力フォーカスのあるコントロールとして表示するフォーム上のコントロールID既定値空の文字列 ("") です。

解説解説
使用例使用例

指定したコントロールを、フォーム読み込んだときに入力フォーカスのあるコントロールとしてフォーム上に表示するように DefaultFocus プロパティ設定する方法次のコード例示しますForm1表示されると、挿入ポインタTextBox1配置されることに注目してください。これは TextBox1 コントロールフォーカスがあることを示します

<%@ Page Language="VB" %>

<script runat=Server>
       
  Sub Page_Load(ByVal sender As
 Object, ByVal e As System.EventArgs)
    
    ' Set the text of the two label controls.
    Label1.Text = "The DefaultButton property is set to "
 _
                  & Form1.DefaultButton.ToString & "<br/>"
    Label2.Text = "The DefaultFocus property is set to "
 _
                  & Form1.DefaultFocus.ToString
  End Sub
     
 </script>

<html>

<head>

    <title>HtmlForm DefaultButton and DefaultFocus Properties
 Example</title>

</head>

<body>

  <form id="Form1"
        defaultbutton="SubmitButton"
        defaultfocus="TextBox1"
        runat="server">
    
    <h3>HtmlForm DefaultButton and DefaultFocus Properties
 Example</h3>        
  
    TextBox1:
    <asp:textbox id="TextBox1"
                 autopostback=true 
                 runat="server">
    </asp:textbox>
  
    <br />
  
    TextBox2:
    <asp:textbox id="TextBox2"
                 autopostback=true 
                 runat="server">
    </asp:textbox>
  
    <br /><br />
  
    <asp:button id="SubmitButton"
                text="Submit" 
                runat="server">
    </asp:button>
  
    <asp:button id="CancelButton" 
                text="Cancel"
                runat="server">
    </asp:button>
  
    <hr />
  
    <asp:label id="Label1"
               runat=Server>
    </asp:label>
  
    <asp:label id="Label2"
               runat=Server>
    </asp:label>

  </form>

</body>

</html>
<%@ page language="C#" %>

<script runat="server">     
   
  void Page_Load(object sender, System.EventArgs e)
  {
    
    // Set the text of the two label controls.
    Label1.Text = "The DefaultButton property is set to "
                + Form1.DefaultButton.ToString() + "<br/>";
    Label2.Text = "The DefaultFocus property is set to "
                + Form1.DefaultFocus.ToString();
  }

</script>

<html>

<head>

    <title>HtmlForm DefaultButton and DefaultFocus Properties Example</title>

</head>

<body>

  <form id="Form1"
        defaultbutton="SubmitButton"
        defaultfocus="TextBox1"
        runat="server">
    
    <h3>HtmlForm DefaultButton and DefaultFocus Properties Example</h3>
        
  
    TextBox1:
    <asp:textbox id="TextBox1"
                 autopostback=true 
                 runat="server">
    </asp:textbox>
  
    <br />
  
    TextBox2:
    <asp:textbox id="TextBox2"
                 autopostback=true 
                 runat="server">
    </asp:textbox>
  
    <br /><br />
  
    <asp:button id="SubmitButton"
                text="Submit" 
                runat="server">
    </asp:button>
  
    <asp:button id="CancelButton" 
                text="Cancel"
                runat="server">
    </asp:button>
  
    <hr />
  
    <asp:label id="Label1"
               runat=Server>
    </asp:label>
  
    <asp:label id="Label2"
               runat=Server>
    </asp:label>

  </form>

</body>

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


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS