Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. <div class="col-xs-12 col-sm-4 no-margin product-item-holder hover"> <!-- this div will be repeated for each product -->
  2. <div class="product-item">
  3. <div class="image">
  4. <img runat="server" id="img" alt="" src="" />
  5. </div>
  6. <div class="body">
  7. <div class="label-discount clear"></div>
  8. <div class="title">
  9. <a runat="server" id="name" href="single-product.html"></a>
  10. </div>
  11. </div>
  12. <div class="prices">
  13. <div class="price-prev"></div>
  14. <div runat="server" id="price" class="price-current pull-right"></div>
  15. </div>
  16. <div class="hover-area">
  17. <div class="add-cart-button">
  18. <a href="single-product.html" class="le-button">Enquiry</a>
  19. </div>
  20.  
  21. </div>
  22. </div>
  23.  
  24. dbConnection cn = new dbConnection();
  25. protected void Page_Load(object sender, EventArgs e)
  26. {
  27. if (!IsPostBack)
  28. {
  29. getLoopData();
  30. }
  31. }
  32.  
  33. public void getLoopData()
  34. {
  35. cn.con.Open();
  36. cn.cmd.Connection = cn.con;
  37. cn.cmd.CommandText = "select * FROM products";
  38. MySqlDataReader reader = cn.cmd.ExecuteReader();
  39.  
  40. while (reader.Read())
  41. {
  42. //int id = reader.GetInt32(0);
  43. name.InnerText = reader["InventionName"].ToString();
  44. price.InnerText = reader["Price"].ToString();
  45. img.Src = reader["Picture"].ToString();
  46.  
  47. }
  48. reader.Close();
  49. cn.con.Close();
  50. }
  51.  
  52. <asp:Repeater ID="ProductRepeater" runat="server" EnableViewState="False">
  53. <ItemTemplate>
  54. <div class="product-item">
  55. <div class="image">
  56. <img id="img" alt="" src='<%# Eval("Picture") %>' />
  57. ///...
  58. </ItemTemplate>
  59. </asp:Repeater>
  60.  
  61. cn.con.Open();
  62. cn.cmd.Connection = cn.con;
  63. cn.cmd.CommandText = "SELECT InventionName, Price, Picture FROM products";
  64. MySqlDataReader reader = cn.cmd.ExecuteReader();
  65. ProductRepeater.DataSource = reader;
  66. ProductRepeater.DataBind();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement