Repeater Control: Split Mark-Up Tags across the Templates

The Repeater control is the only Web control that allows you to split markup tags across the templates. To create a table using templates, include the begin table tag (<table>) in the HeaderTemplate, a single table row tag (<tr>) in the ItemTemplate, and the end table tag (</table>) in the FooterTemplate.

Example:

<asp:Repeater id=Repeater1 runat="server">
    <HeaderTemplate>
        <TABLE border=1 id="table1">
        <THEAD>
        <tr>
           <th><b>Column1</b></th>
           <th><b>Column2</b></th>
        </tr>
        </THEAD>
        <TBODY>
    </HeaderTemplate>

    <ItemTemplate>
        <tr>
        <td> <%# DataBinder.Eval(Container.DataItem, "XXXX") %> </td>
        <td> <%# DataBinder.Eval(Container.DataItem, "XXXX") %> </td>
        </tr>
    </ItemTemplate>

    <FooterTemplate>
        </TBODY>
        </TABLE>
    </FooterTemplate>
</asp:Repeater>

 

Comments

# Repeater Control: Split Mark-Up Tags across the Templates &laquo; KaushaL.NET

Pingback from  Repeater Control: Split Mark-Up Tags across the Templates « KaushaL.NET