This documentation is archived and is not being maintained.

HtmlTextArea.Name Property

Gets or sets the unique identifier name for the HtmlTextArea control.

Namespace:  System.Web.UI.HtmlControls
Assembly:  System.Web (in System.Web.dll)

public virtual string Name { get; set; }
<asp:HtmlTextArea Name="String" />

Property Value

Type: System.String
A string that represents the value of the Control.UniqueID property.

Use the Name property to determine the unique identifier name for the HtmlTextArea control. In this implementation of the property, the get accessor returns the value of the Control.UniqueID property. However, the set accessor does not assign a value to this property.


The set accessor does not assign a value to this property because the Name property must have the same value as the Control.UniqueID property for the HtmlTextArea control to work properly.

Classes that inherit from the HtmlTextArea class may override this implementation, if necessary.

The following code example demonstrates how to use the Name property to select an HtmlTextArea control on a page and set its Value property.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<script runat="server" >

  void Page_Load(Object sender, EventArgs e)

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


  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();


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



<html xmlns="" >
    <title>HtmlTextArea Name Example</title>


   <form id="form1" runat="server">

      <h3>HtmlTextArea Name Example</h3>

      Notice that Category 3 has custom text. <br />  

      <asp:Repeater id="Repeater1"


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

            Enter text:

            <br />

            <textarea rows="2" cols="20" id="TextArea1" 

            <br /><br />

            <hr />





Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0