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

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

HtmlTextArea.Name プロパティ

HtmlTextArea コントロール一意識別名を取得または設定します

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

解説解説

Name プロパティ使用してHtmlTextArea コントロール一意識別名を確認しますプロパティのこの実装では、get アクセサControl.UniqueID プロパティの値を返します。ただし、set アクセサはこのプロパティに値を代入しません。

メモメモ

set アクセサがこのプロパティに値を代入しません。Name プロパティControl.UniqueID プロパティが同じ値を持っていないと、HtmlTextArea コントロール正しく動作しないためです。

HtmlTextArea クラスから継承するクラスは、必要に応じてこの実装オーバーライドできます

使用例使用例

Name プロパティ使用してページHtmlTextArea コントロール選択し、その Value プロパティ設定する方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>
<%@ Import Namespace="System.Data"
 %>

<script runat="server" >
  
  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)

    ' Bind a data source to the Repeater control. 
    Repeater1.DataSource = CreateRepeaterSource()
    Repeater1.DataBind()

  End Sub

  Sub Item_Bound(ByVal sender As
 Object, ByVal e As RepeaterItemEventArgs)
 
    ' The ItemDataBound event is raised when data is bound to an
    ' item in the Repeater control. Items can include the Header,
    ' Footer, and so on. Use the following logic only if the item 
    ' being bound is an Item or AlternatingItem.
    If (e.Item.ItemType = ListItemType.Item) Or
 _
       (e.Item.ItemType = ListItemType.AlternatingItem) Then

      ' The runtime automatically generates a unique identifier
      ' for each control embedded in a list control, such as the
      ' Repeater control. The Name property of the HtmlTextArea 
      ' control contains this unique identifier and is commonly used
 to 
      ' identify a specific control.
            
      ' Retrieve the HtmlTextArea control from the RepeaterItem.
      Dim area As HtmlTextArea = _
          CType(e.Item.FindControl("TextArea1"), HtmlTextArea)

      ' Insert a custom message for the fourth HtmlTextArea control
 by
      ' looking for a Name property that contains the number 3.
      If area.Name.Contains("3")
 Then

        area.Value = "Hello World"

      End If

    End If

  End Sub

  Function CreateRepeaterSource() As DataView

    ' Create a DataTable that contains sample data for the 
    ' Repeater control.
    Dim dt As DataTable = New
 DataTable()
    Dim dr As DataRow
 
    dt.Columns.Add(New DataColumn("Category",
 GetType(String)))
 
    ' Populate the DataTable with sample values.
    Dim i As Integer
 
    For i = 0 To 4
       
      dr = dt.NewRow()
 
      dr(0) = "Category " & i.ToString()

      dt.Rows.Add(dr)
         
    Next i
 
    ' Create a DataView from the DataTable.
    Dim dv As DataView = New
 DataView(dt)
    Return dv

  End Function
  
</script>

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

   <form runat="server">
  
      <h3>HtmlTextArea Name Example</h3>

      Notice that Category 3 has custom text. <br> 
  
      <asp:Repeater id="Repeater1"
                    onitemdatabound="Item_Bound"
                    runat="server">

         <ItemTemplate>

            <h4><%# DataBinder.Eval(Container.DataItem, "Category")
 %></h4>

            Enter text:

            <br>

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

            <br><br>

            <hr>

         </ItemTemplate>

      </asp:Repeater>
  
   </form>

</body>
</html>
<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>

<script runat="server" >
  
  void Page_Load(Object sender, EventArgs e)
  {

    // Bind a data source to the Repeater control. 
    Repeater1.DataSource = CreateRepeaterSource();
    Repeater1.DataBind();

  }

  void Item_Bound(Object sender, RepeaterItemEventArgs e)
  {

    // The ItemDataBound event is raised when data is bound to an 
    // item in the Repeater control. Items can include the Header,
    // Footer, and so on. Use the following logic only if the item 
    // being bound is an Item or AlternatingItem.
    if (e.Item.ItemType == ListItemType.Item ||
        e.Item.ItemType == ListItemType.AlternatingItem)
    {

      // The runtime automatically generates a unique identifier 
      // for each control embedded in a list control, such as the
      // Repeater control. The Name property of the HtmlTextArea 
      // control contains this unique identifier and is commonly used
 to 
      // identify a specific control.

      // Retrieve the HtmlTextArea control from the RepeaterItem.
      HtmlTextArea area = (HtmlTextArea)e.Item.FindControl("TextArea1");

      // Insert a custom message for the fourth HtmlTextArea control
 by
      // looking for a Name property that contains the number 3.
      if (area.Name.Contains("3"))
      {

        area.Value = "Hello World";

      }

    }

  }

  DataView CreateRepeaterSource()
  {

    // Create a DataTable that contains sample data for the 
    // Repeater control.
    DataTable dt = new DataTable();
    DataRow dr;

    dt.Columns.Add(new DataColumn("Category", typeof(String)));

    // Populate the DataTable with sample values.
    for (int i = 0; i < 5; i++)
    {
      dr = dt.NewRow();

      dr[0] = "Category " + i.ToString();

      dt.Rows.Add(dr);
    }

    // Create a DataView from the DataTable.
    DataView dv = new DataView(dt);
    return dv;

  }
  
</script>

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

   <form runat="server">
  
      <h3>HtmlTextArea Name Example</h3>

      Notice that Category 3 has custom text. <br>  
  
      <asp:Repeater id="Repeater1"
                    onitemdatabound="Item_Bound"
                    runat="server">

         <ItemTemplate>

            <h4><%# DataBinder.Eval(Container.DataItem, "Category")
 %></h4>

            Enter text:

            <br>

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

            <br><br>

            <hr>

         </ItemTemplate>

      </asp:Repeater>
  
   </form>

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


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

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

辞書ショートカット

すべての辞書の索引

「HtmlTextArea.Name プロパティ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS