aspxtreme

Server Control Inline Template Syntax

ASP.NET Syntax   ASP.NET Page Syntax


Customizes the look and layout of ASP.NET server controls that support templates.

<templatename>
   Server control, databinding syntax, and so on
</templatename>

Markup Tags


templatename The name of the ASP.NET server control template.

Remarks

The following ASP.NET server controls support templates: the Repeater Web Server Control, the DataList Web Server Control, and the DataGrid Web Server Control. You can use template properties to customize the appearance of server controls on the pages in which they appear. You can include multiple template properties in a server control declaration. Template syntax must be contained between the opening and closing tags of one of these server controls or between the opening and closing tags of a custom server control you have created ) For information about developing controls that can use inline style templates, see Developing Templated Controls.

Syntax Example

The below code snippet shows how you can display a list of employee names, phone numbers, and email addresses using templates in the DataList ASP.NET control. The layout of the employee information is specified in the ItemTemplate template using data-bound controls.

<asp:DataList id="myDataList" runat="server">

   <HeaderTemplate>
      Employee List
   <HeaderTemplate>

   <ItemTemplate>
      <asp:Label runat=server
         Text = "<% Container.DataItem.EmployeeName %>" />
      <asp:Label runat=server
         Text = "<% Container.DataItem.PhoneNumber %>" />
      <asp:HyperLink runat=server
         Text = "<% Container.DataItem.Email %>"
         NavigateURL = "<% Container.DataItem.Link %>" />
 )
   </ItemTemplate>

</asp:DataList>
See Also

Developing Templated Controls   Custom Server Control Syntax



Books and more ...


Suggested Reading

Need a break ?



Previous page Back to top Next page

Check out related books at Amazon

© 2000-2008 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 aspxtreme