Create a shopping cart asp.net
public void Create_Galary(DataTable dt)
{
DataTable dt2 = new DataTable();
dt2 = dt;
if (dt2.Rows.Count > 0)
{
for (int m = 0; m < dt2.Rows.Count; m++)
{
Image im = new Image();//Creat image tab....
im.Attributes["style"] = "width:150px;height: 150px; padding:5px 0 5px 10px;float:right;";
string ImageID = "im";
im.ID = ImageID + (m);
im.ImageUrl = dt2.Rows[m][1].ToString(); //dt is a datatable...Rows[x][y] means taking the exact colum value.
Label product_title_label = new Label();
product_title_label.ID = "Title";
product_title_label.Text = dt2.Rows[m][0].ToString();
HyperLink lb_pro_title = new HyperLink();//title viewing label
lb_pro_title.ID = "b1";
string pro_link = "Details.aspx?PID=" + dt2.Rows[m][3].ToString() + "&price=" + dt2.Rows[m][2].ToString()+"&PName="+dt2.Rows[m][0].ToString();
lb_pro_title.NavigateUrl = pro_link;
lb_pro_title.Controls.Add(product_title_label);
Label price_label = new Label();//price viewing label
price_label.ID = "Price";
price_label.Text = dt2.Rows[m][2].ToString();
//now creat product title div tag
HtmlGenericControl div = new HtmlGenericControl("div");//import .. System.Web.UI.HtmlControls.. to work this properlly out
div.ID = "product_title";
div.Attributes["style"] = "color:#ea2222;padding:5px 0 5px 0;font-weight:bold;";
div.Controls.Add(lb_pro_title);
//here create the directly add to cart icon div tag
HyperLink directly_add_cart_button = new HyperLink();
directly_add_cart_button.ID = "AddToCart";
directly_add_cart_button.Attributes["style"] = "width:6px,height:6px, background:url(images/cart.gif) no-repeat center;float:left;padding:6px 0 0 6px;";
directly_add_cart_button.ImageUrl = "images/cart.gif";
directly_add_cart_button.NavigateUrl = "CustomerFeedback.aspx";//this page shoul be cart.aspx
//strat the prod details tab...this is includes 'directly add to cart and go to details page';
HtmlGenericControl div_1 = new HtmlGenericControl("div");//import .. System.Web.UI.HtmlControls.. to work this properlly out
div_1.ID = "prod_details_tab";
div_1.Attributes["style"] = "width:150px;height:31px;float:left;background:url(images/products_details_bg.gif) no-repeat center;";
div_1.Controls.Add(directly_add_cart_button);
HtmlGenericControl div1 = new HtmlGenericControl("div");//import .. System.Web.UI.HtmlControls.. to work this properlly out
div1.ID = "center_prod_box";
div1.Attributes["style"] = "width:150px;height: 150px;background:url(images/product_box_center.gif) repeat-y;float:left; text-align:center;padding:0px; margin:0px;";
div1.Controls.Add(div);
div1.Controls.Add(im);
div1.Controls.Add(price_label);
div1.Controls.Add(div_1);
HtmlGenericControl div2 = new HtmlGenericControl("div");//import .. System.Web.UI.HtmlControls.. to work this properlly out
div2.ID = "top_prod_box";
div2.Attributes["style"] = "width:150px;height:12px;background:url(images/product_box_top.gif) no-repeat center bottom;float:left; padding:0px; margin:0px;";
div2.Controls.Add(div1);
/*complete up to viewing product title,image, product price */
HtmlGenericControl div4 = new HtmlGenericControl("div");//import .. System.Web.UI.HtmlControls.. to work this properlly out
div4.ID = "center_content";
div4.Attributes["style"] = "width:150px;height:250px;float:left;padding:10px 10px 10px 11px;";
div4.Controls.Add(div2);
this.form2.Controls.Add(div4);
}
}
}
// image is below
Comments
Post a Comment