Front-end code:
Copy codeThe Code is as follows: <asp: Repeater ID = "rptarry" runat = "server">
<HeaderTemplate> <table> </HeaderTemplate>
<ItemTemplate>
<Tr> <td> <% # GetDataItem () %> </td> </tr>
</ItemTemplate>
<FooterTemplate> </table> </FooterTemplate>
</Asp: Repeater>
<Asp: Repeater ID = "rptarryList" runat = "server">
<HeaderTemplate> <table> </HeaderTemplate>
<ItemTemplate>
<Tr> <td> <% # GetDataItem () %> </td> </tr>
</ItemTemplate>
<FooterTemplate> </table> </FooterTemplate>
</Asp: Repeater>
Background code:Copy codeThe Code is as follows: public void bindrptarry ()
{
String strs = "li | wen | yuan ";
String [] str = strs. Split ('| ');
Rptarry. DataSource = str;
Rptarry. DataBind ();
}
Public void bindrptarryList ()
{
String strs = "li | wen | yuan ";
String [] str = strs. Split ('| ');
Rptarry. DataSource = arrayList ();
Rptarry. DataBind ();
}
Public ArrayList arrayList ()
{
ArrayList aL = new ArrayList ();
AL. Add ("liceshi ");
AL. Add ("wenceshi ");
AL. Add ("yuanceshi ");
Return aL;
}
Bind the data source (array or ArrayList) with DataSource in the background and call the DataBind () method,
Call <% # GetDataItem () %> at the front end.
If there are any errors, you are welcome to criticize and correct them and make progress together.