asp.net WebForm

Repeater 





<script language="C#" runat="server">

 

protected void Page_Load(object sender, EventArgs e)
{

  if (!IsPostBack)
  {
    ArrayList values = new ArrayList();

    values.Add(new PositionData("Microsoft", "Msft"));
    values.Add(new PositionData("Intel", "Intc"));
    values.Add(new PositionData("Dell", "Dell"));

    Repeater1.DataSource = values;
    Repeater1.DataBind();

    Repeater2.DataSource = values;
    Repeater2.DataBind();
  }

}

</script>



<asp:Repeater ID="Repeater2" runat="server"> <HeaderTemplate> Company data: </HeaderTemplate> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "Name") %> (<%# DataBinder.Eval(Container.DataItem, "Ticker") %>) </ItemTemplate> <SeparatorTemplate>, </SeparatorTemplate> </asp:Repeater>

 

posted @ 2020-12-23 22:38  超难微猫  阅读(141)  评论(0编辑  收藏  举报