Search
Author
ASP.NET Tutorials
Author
Sheo Narayan
Advertisements


Winners

Win Prizes

Social Presence
Like us on Facebook

Silverlight Tutorials | Report a Bug in the Tutorial
asp:Repeater control
Repeater control displays data using user-defined layout.
 
Repeater control displays data using user-defined layout. It just repeats the HTML and ASP.NET controls that is placed inside a template block.
Following are some important properties that are very useful.
AlternatingItemTemplate Template to define the rendering of every alternate item.
FooterTemplate Template to define how to render the footer.
HeaderTemplate Template to define how to render the header.
Items Gets the the collection of RepeaterItem.
ItemTemplate Template to define how items are rendered.
SeparatorTemplate Template to define how separator between items will be rendered.
DEMO : Repeater Show Source Code

This is the Header of the Repeater Control

17483

17487

17488

17489

17491

17482 dsafds ghthg 54654647765 fghnfgjhb

17485 fdfd

17486 fdfd

17484 gg fgfd fggfd fdg

17480 jessy k k nagar 32143534657 Mumbai

17490 sa as 1213 12121212

17479 sangi ashok nagar 1234567890 chennai
No records displaying or need more records? Try inserting records from FormView Control tutorial.
 
    
        // Repeater control /////////////////////////////                    
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
        <HeaderTemplate>
            <h3>This is the Header of the Repeater Control</h3>
        </HeaderTemplate>
        <AlternatingItemTemplate>
            <table border="1" style="background-color:#c0c0c0;" width="100%">
                <tr>
                    <td style="width:10%;"><%# Eval("AutoID") %></td>
                    <td style="width:25%;"><%# Eval("Name") %></td>
                    <td style="width:40%;"><%# Eval("Address") %></td>
                    <td style="width:10%;"><%# Eval("Phone") %></td>
                    <td style="width:15%;"><%# Eval("City") %></td>
                </tr>
            </table>
        </AlternatingItemTemplate>
        <ItemTemplate>
            <table border="1" width="100%">
                <tr>
                    <td style="width:10%;"><%# Eval("AutoID") %></td>
                    <td style="width:25%;"><%# Eval("Name") %></td>
                    <td style="width:40%;"><%# Eval("Address") %></td>
                    <td style="width:10%;"><%# Eval("Phone") %></td>
                    <td style="width:15%;"><%# Eval("City") %></td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:Repeater>
    
    
    
    // SqlDataSource control /////////////////////////////
     <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:ConnStr %>'
     SelectCommand="Select * FROM SampleForTutorials ORDER BY [Name]">
     </asp:SqlDataSource>