asp.net.ph

TemplateColumn.ItemTemplate Property

System.Web.UI.WebControls Namespace   TemplateColumn Class


Specifies the template to use for each item in a TemplateColumn.

Syntax

<asp:templatecolumn ... >

   <itemtemplate>
      ... template definition here
   </itemtemplate>

</asp:templatecolumn>

Property Value

An ITemplate interface that defines how the individual items in the TemplateColumn control are rendered.

The property is read/write with no default value.

Remarks

The ItemTemplate describes the layout of elements that are rendered once for each row in the data source. You can set the appearance for the items in this template using the ItemStyle property.

To specify a template for the items of a TemplateColumn, declare an <ItemTemplate> element between the opening and closing tags of the control. You can then list the contents of the template between the opening and closing <ItemTemplate> ... </ItemTemplate> tags.

Items in the ItemTemplate are data-bound. To display data in the ItemTemplate, declare one or more Web server controls and set their data-binding expressions to evaluate to a field in the parent DataGrid control's DataSource.

First Name: <asp:Label runat = "server"
   Text = "<%# Eval ( "FirstName" ) %>" />

For more information, see DataBinding Expression Syntax.

See Also

TemplateColumn Members   EditItemTemplate   HeaderTemplate   FooterTemplate Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph