ASP.NET Repeater


/ Published in: ASP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <form id="form1" runat="server">
  2. <div>
  3. <asp:Repeater ID="Repeater1" runat="server">
  4. <ItemTemplate>
  5. <%# DataBinder.Eval(Container.DataItem, "Name") %>
  6. <br />
  7. </ItemTemplate>
  8.  
  9. </asp:Repeater>
  10. </div>
  11. </form>
  12.  
  13. -------
  14.  
  15. private string connString;
  16. private OracleConnection cs;
  17. OracleDataAdapter da = new OracleDataAdapter();
  18.  
  19. protected void Page_Load(object sender, EventArgs e)
  20. {
  21. DataTable dt = new DataTable();
  22. connString = ConfigurationManager.ConnectionStrings["Dev Connection"].ConnectionString;
  23. cs = new OracleConnection(connString);
  24. OracleCommand oraclecmd = new OracleCommand("select name from i2mslive.zone order by name", cs);
  25. cs.Open();
  26. da.SelectCommand = oraclecmd;
  27. da.Fill(dt);
  28. cs.Close();
  29. Repeater1.DataSource = dt;
  30. Repeater1.DataBind();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.