Mobile Content

Friday, January 27, 2012

Repeater Controls In

The Repeater control is used to display a repeated list of items that are bound to the control. The Repeater control may be bound to a database table, an XML file, or another list of items. 

Template NameDescription
ItemTemplateDefines the content and layout of items within the list. Required.
AlternatingItemTemplateIf defined, the AlternatingItemTemplate determines the content and layout of alternating items. If not defined, ItemTemplate is used.
SeparatorTemplateIf defined, the SeparatorTemplate is rendered between items (and alternating items). If not defined, a separator is not rendered.
HeaderTemplateIf defined, the HeaderTemplate determines the content and layout of the list header. If not defined, header is not rendered.
FooterTemplateIf defined, the FooterTemplate determines the content and layout of the list footer. If not defined, footer is not rendered.


<asp:Repeater id=Repeater1 runat="server">


                <table border=1>



                  <td> <%# Eval("Name") %> </td>
                  <td> <%# Eval("Code") %> </td>









        <asp:Repeater id=Repeater2 runat="server">

                Company data:

                <%# Eval("Name") %> 
                <%#Eval("Code") %>)
</ItemTemplate> <SeparatorTemplate>, </SeparatorTemplate> </asp:Repeater>

In .cs page
void Page_Load(Object Sender, EventArgs e) {

            if (!IsPostBack) {

                ArrayList values = new ArrayList();

                values.Add("Microsoft", "2001");
                values.Add("Intel", "2002");
                values.Add("Dell", "2003");

                Repeater1.DataSource = values;


Company   Symbol
Microsoft 2001
Intel     2002
Dell      2003

No comments:

Post a Comment