protected void addproducts_ByName(string name) { StoneView sv = s.getStone_Byname(name); #region create HtmlGenericControl HtmlGenericControl New_stone_div1 = new HtmlGenericControl("div"); HtmlGenericControl New_stone_div2 = new HtmlGenericControl("div"); HtmlGenericControl New_stone_div3 = new HtmlGenericControl("div"); HtmlImage img_for_stone = new HtmlImage(); HtmlGenericControl New_stone_div4 = new HtmlGenericControl("div"); HtmlGenericControl New_stone_div5_AddToCart = new HtmlGenericControl("div"); HtmlButton BTN_AddToCart = new HtmlButton(); HtmlGenericControl New_stone_div6_Price = new HtmlGenericControl("div"); HtmlGenericControl New_stone_span_Price = new HtmlGenericControl("span"); HtmlGenericControl a_stone = new HtmlGenericControl("a"); #endregion #region class for HtmlGenericControl New_stone_div1.Attributes["Class"] = "col-sm-12 col-md-6 col-lg-4 p-b-50"; New_stone_div2.Attributes["Class"] = "block2"; New_stone_div3.Attributes["Class"] = "block2-img wrap-pic-w of-hidden pos-relative"; New_stone_div4.Attributes["Class"] = "block2-overlay trans-0-4"; New_stone_div5_AddToCart.Attributes["Class"] = "block2-btn-addcart w-size1 trans-0-4"; BTN_AddToCart.Attributes["Class"] = "flex-c-m size1 bg4 bo-rad-23 hov1 s-text1 trans-0-4"; a_stone.Attributes["Class"] = "block2-name dis-block s-text3 p-b-5"; New_stone_div6_Price.Attributes["Class"] = "block2-txt p-t-20"; New_stone_span_Price.Attributes["Class"] = "block2-price m-text6 p-r-5"; #endregion img_for_stone.Src = "../../" + sv.ImagePath; img_for_stone.Alt = "IMG-PRODUCT"; New_stone_span_Price.InnerHtml = "Stone Weight: " + sv.Weight.ToString(); a_stone.InnerHtml = "Stone Name: " + sv.Name.ToString(); BTN_AddToCart.InnerHtml = "Add to Cart"; New_stone_div5_AddToCart.Controls.Add(BTN_AddToCart); New_stone_div4.Controls.Add(New_stone_div5_AddToCart); New_stone_div3.Controls.Add(img_for_stone); New_stone_div3.Controls.Add(New_stone_div4); New_stone_div6_Price.Controls.Add(a_stone); New_stone_div6_Price.Controls.Add(New_stone_span_Price); New_stone_div2.Controls.Add(New_stone_div3); New_stone_div2.Controls.Add(New_stone_div6_Price); New_stone_div1.Controls.Add(New_stone_div2); stones_div_table.Controls.Add(New_stone_div1); }
protected void Page_Load(object sender, EventArgs e) { if (Session["User_Customer"] == null) { Response.Redirect("LoginCustomer.aspx"); } customerUser = (Customer)Session["User_Customer"]; List <string> stones_names = o.readfromyDS_o(customerUser.Username.ToString()); foreach (var item in stones_names) { list_stones_cart.Add(s.getStone_Byname(item.ToString())); } //addproducts(); if (!IsPostBack) { addproducts_c(); } }