예제 #1
0
    public void setproduct()
    {
        products  pr   = new products();
        DataTable dt   = new DataTable();
        category  cat  = new category();
        brand     brnd = new brand();

        if (Request.QueryString["cat_id"] == null && Request.QueryString["brand_id"] == null)
        {
            dt = pr.getproduct();
        }
        else if (Request.QueryString["cat_id"] != null && Request.QueryString["brand_id"] == null)
        {
            dt = pr.getproduct_cat(Request.QueryString["cat_id"].ToString());
            list_footer_menu.InnerHtml += "<li><span class=\"icon-chevron-left\"></span></li>";

            string cat_name = cat.getcategory(Request.QueryString["cat_id"].ToString()).Rows[0]["name"].ToString();
            list_footer_menu.InnerHtml += "<li><a href=\"shop.aspx?cat_id=" + Request.QueryString["cat_id"].ToString() + "\">" + cat_name + "</a> </li>";
            tourStep2.InnerHtml         = "";
        }
        else if (Request.QueryString["cat_id"] == null && Request.QueryString["brand_id"] != null)
        {
            dt = pr.getproduct_brand(Request.QueryString["brand_id"].ToString());
            list_footer_menu.InnerHtml += "<li><span class=\"icon-chevron-left\"></span></li>";

            string brand_name = brnd.getbrandbyid(Request.QueryString["brand_id"].ToString()).Rows[0]["name"].ToString();
            list_footer_menu.InnerHtml += "<li><a href=\"shop.aspx?brand_id=" + Request.QueryString["brand_id"].ToString() + "\">" + brand_name + "</a> </li>";
            tourStep3.InnerHtml         = "";
        }


        foreach (DataRow list in dt.Rows)
        {
            DataTable pname     = pr.getonepic(Convert.ToInt32(list["id"]));
            string    catname   = cat.getcategory(list["cat_id"].ToString()).Rows[0]["name"].ToString();
            string    brandname = brnd.getbrandbyid(list["brand_id"].ToString()).Rows[0]["name"].ToString();

            //Response.Write(catname);
            //Response.Write("-");
            //Response.Write(pname["name"].ToString());
            //Response.Write("-");

            HtmlGenericControl div = new HtmlGenericControl("div");
            // div.Attributes.Add("id", "p-item" + list["id"].ToString());
            div.Attributes.Add("class", "span3 filter--cat_id" + list["cat_id"]);
            div.Attributes.Add("data-price", list["price"].ToString());
            div.Attributes.Add("data-popularity", "2");
            div.Attributes.Add("data-size", "xs|s|m|xl");
            div.Attributes.Add("data-color", "pink");
            div.Attributes.Add("data-brand", "brand_id" + list["brand_id"].ToString());
            //div.Attributes.Add("runat", "server");


            HtmlGenericControl divproduct = new HtmlGenericControl("div");
            //div2.Attributes.Add("id", "p-item2-" + list["id"].ToString());
            divproduct.Attributes.Add("class", "product");


            HtmlGenericControl divproductimg = new HtmlGenericControl("div");
            // div3.Attributes.Add("id", "p-item3-" + list["id"].ToString());
            divproductimg.Attributes.Add("class", "product-img");


            HtmlGenericControl divpicture = new HtmlGenericControl("div");
            //div4.Attributes.Add("id", "p-item4-" + list["id"].ToString());
            divpicture.Attributes.Add("class", "picture");


            HtmlGenericControl imgpicture = new HtmlGenericControl("img");
            imgpicture.Attributes.Add("id", "p-img" + list["id"].ToString());
            //img1.Attributes.Add("runat", "server");
            imgpicture.Attributes.Add("width", "540");
            imgpicture.Attributes.Add("height", "374");
            imgpicture.Attributes.Add("alt", "");
            // img1.Attributes.Add("src", (Server.MapPath("~/images/Ppic/").ToString())+list["id"].ToString()+".jpg");
            //imgpicture.Attributes.Add("src", "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg");
            string picname = null;
            if (pname.Rows.Count != 0)
            {
                //imgpicture.Attributes.Add("src", "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg");
                picname = "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg";
            }
            else
            {
                //imgpicture.Attributes.Add("src", "images/Ppic/noimage.jpg");
                picname = "images/Ppic/noimage.jpg";
            }
            imgpicture.Attributes.Add("src", picname);

            divpicture.Controls.Add(imgpicture);

            HtmlGenericControl divimgoverlay = new HtmlGenericControl("div");
            //div5.Attributes.Add("id", "p-div5" + list["id"].ToString());
            divimgoverlay.Attributes.Add("class", "img-overlay");


            //HtmlGenericControl br1 = new HtmlGenericControl("br");
            //div2.Controls.Add(br1);

            HtmlGenericControl aimgoverlay = new HtmlGenericControl("a");
            ///a1.Attributes.Add("id", "a1" + list["id"].ToString());
            aimgoverlay.Attributes.Add("href", "product.aspx?id=" + list["id"].ToString());
            aimgoverlay.Attributes.Add("class", "btn more btn-primary");
            aimgoverlay.InnerText = "توضیحات بیشتر";
            divimgoverlay.Controls.Add(aimgoverlay);

            HtmlAnchor aimgoverlay2 = new HtmlAnchor();
            aimgoverlay2.ID           = "addtocart" + list["id"].ToString();
            aimgoverlay2.HRef         = "#";
            aimgoverlay2.Name         = list["id"].ToString() + "," + list["price"].ToString() + "," + picname + "," + catname + " - " + brandname + " - " + list["name"].ToString();
            aimgoverlay2.ServerClick += new System.EventHandler(addtocart_click);
            aimgoverlay2.Attributes.Add("class", "btn buy btn-danger");
            aimgoverlay2.Attributes.Add("onclick", "addtocart('" + "p-img" + list["id"].ToString() + "');");
            aimgoverlay2.InnerText = "اضافه به سبد خرید";

            UpdatePanel up = new UpdatePanel();
            up.ContentTemplateContainer.Controls.Add(aimgoverlay2);
            divimgoverlay.Controls.Add(up);
            divimgoverlay.Controls.Add(aimgoverlay);
            //divimgoverlay.Controls.Add(aimgoverlay2);
            divpicture.Controls.Add(divimgoverlay);
            divproductimg.Controls.Add(divpicture);
            divproduct.Controls.Add(divproductimg);
            //HtmlGenericControl a2 = new HtmlGenericControl("a");
            //// a2.Attributes.Add("id", "a2" + list["id"].ToString());
            //a2.Attributes.Add("href", "#");
            //a2.Attributes.Add("class", "btn buy btn-danger");
            //
            //div5.Controls.Add(a2);

            //                    <!-- Sub Text -->
            HtmlGenericControl divmaintitle = new HtmlGenericControl("div");
            // div6.Attributes.Add("id", "p-div6" + list["id"].ToString());
            divmaintitle.Attributes.Add("class", "main-titles no-margin");


            HtmlGenericControl h4maintitle = new HtmlGenericControl("h4");
            h4maintitle.Attributes.Add("class", "title");
            h4maintitle.InnerText = catname + " - " + brandname + " - " + list["name"].ToString();
            divmaintitle.Controls.Add(h4maintitle);

            HtmlGenericControl h5maintitle = new HtmlGenericControl("h5");
            h5maintitle.Attributes.Add("class", "no-margin isotope--title");
            h5maintitle.InnerText = String.Format("{0:#,##0}", list["price"]) + " ریال";
            divmaintitle.Controls.Add(h5maintitle);
            divproduct.Controls.Add(divmaintitle);
            div.Controls.Add(divproduct);
            isotopeContainer.Controls.Add(div);
        }
    }
    public void order_detail_inner(HtmlGenericControl divcollapse_inner, string order_id, string sendprice, string totalprice)
    {
        orderlist          orlist        = new orderlist();
        category           cat           = new category();
        brand              brnd          = new brand();
        DataTable          product_order = orlist.get_product_order(order_id);
        products           pro           = new products();
        HtmlGenericControl table_order   = new HtmlGenericControl("table");

        table_order.Attributes.Add("class", "table table-items");
        HtmlGenericControl table_head    = new HtmlGenericControl("thead");
        HtmlGenericControl tr_table_head = new HtmlGenericControl("tr");

        HtmlGenericControl th_name_tr_table_head = new HtmlGenericControl("th");

        th_name_tr_table_head.Attributes.Add("colspan", "2");
        th_name_tr_table_head.InnerHtml = "مشخصات محصول";
        tr_table_head.Controls.Add(th_name_tr_table_head);

        HtmlGenericControl th_number_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_number_tr_table_head = new HtmlGenericControl("div");

        div_th_number_tr_table_head.Attributes.Add("class", "align-center");
        div_th_number_tr_table_head.InnerText = "تعداد";
        th_number_tr_table_head.Controls.Add(div_th_number_tr_table_head);
        tr_table_head.Controls.Add(th_number_tr_table_head);

        HtmlGenericControl th_unitprice_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_unitprice_tr_table_head = new HtmlGenericControl("div");

        div_th_unitprice_tr_table_head.Attributes.Add("class", "align-right");
        div_th_unitprice_tr_table_head.InnerText = "قیمت واحد";
        th_unitprice_tr_table_head.Controls.Add(div_th_unitprice_tr_table_head);
        tr_table_head.Controls.Add(th_unitprice_tr_table_head);

        HtmlGenericControl th_price_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_price_tr_table_head = new HtmlGenericControl("div");

        div_th_price_tr_table_head.Attributes.Add("class", "align-right");
        div_th_price_tr_table_head.InnerText = "قیمت کل";
        th_price_tr_table_head.Controls.Add(div_th_price_tr_table_head);
        tr_table_head.Controls.Add(th_price_tr_table_head);


        table_head.Controls.Add(tr_table_head);
        table_order.Controls.Add(table_head);


        HtmlGenericControl table_body_order = new HtmlGenericControl("tbody");
        int total_price = 0;

        foreach (DataRow dr in product_order.Rows)
        {
            string             catname   = cat.getcategory(dr["cat_id"].ToString()).Rows[0]["name"].ToString();
            string             brandname = brnd.getbrandbyid(dr["brand_id"].ToString()).Rows[0]["name"].ToString();
            DataTable          pic       = pro.getonepic(int.Parse(dr["product_id"].ToString()));
            HtmlGenericControl tr        = new HtmlGenericControl("tr");
            HtmlGenericControl tdimg     = new HtmlGenericControl("td");
            tdimg.Attributes.Add("class", "image");
            HtmlGenericControl img = new HtmlGenericControl("img");
            img.Attributes.Add("src", "images/Ppic/" + pic.Rows[0]["name"].ToString() + ".jpg");
            img.Attributes.Add("alt", "");
            img.Attributes.Add("width", "50");
            img.Attributes.Add("height", "50");
            tdimg.Controls.Add(img);
            tr.Controls.Add(tdimg);//finish td img

            HtmlGenericControl tddesc = new HtmlGenericControl("td");
            tddesc.Attributes.Add("class", "desc");
            tddesc.InnerText = catname + "-" + brandname + " - " + dr["name"].ToString();


            tr.Controls.Add(tddesc);//finish td by class desc

            HtmlGenericControl tdqty = new HtmlGenericControl("td");
            tdqty.Attributes.Add("class", "qty");
            HtmlGenericControl divnumber = new HtmlGenericControl("div");
            divnumber.Attributes.Add("class", "numbered");
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            //HtmlInputText input = new HtmlInputText();
            HtmlGenericControl input = new HtmlGenericControl("input");
            input.Attributes.Add("name", "input_number" + dr["id"].ToString());
            input.Attributes.Add("class", "tiny-size");
            input.Attributes.Add("value", dr["count"].ToString());
            input.Attributes.Add("type", "text");
            input.Attributes.Add("readonly", "readonly");
            input.Attributes.Add("id", "input_number" + dr["id"].ToString());
            divnumber.Controls.Add(input); //finish input
            tdqty.Controls.Add(divnumber);
            tr.Controls.Add(tdqty);        //finish td by class qty

            HtmlGenericControl td_unit_price = new HtmlGenericControl("td");
            td_unit_price.Attributes.Add("class", "price");
            td_unit_price.InnerText = dr["price"].ToString() + "  ریال  ";
            tr.Controls.Add(td_unit_price);//finish td price

            HtmlGenericControl tdprice = new HtmlGenericControl("td");
            tdprice.Attributes.Add("class", "price");
            tdprice.InnerText = ((Int32)dr["price"] * (Int16)dr["count"]).ToString() + "  ریال  ";
            tr.Controls.Add(tdprice);//finish td price
            table_body_order.Controls.Add(tr);
            total_price += (Int32)dr["price"] * (Int16)dr["count"];
        }


        HtmlGenericControl tr_send_price = new HtmlGenericControl("tr");
        HtmlGenericControl td_space      = new HtmlGenericControl("td");

        td_space.Attributes.Add("colspan", "3");
        td_space.Attributes.Add("rowspan", "3");
        td_space.Controls.Add(new LiteralControl("&nbsp;"));
        tr_send_price.Controls.Add(td_space);

        HtmlGenericControl td_stronger_lable = new HtmlGenericControl("td");

        td_stronger_lable.Attributes.Add("class", "stronger");
        td_stronger_lable.InnerText = "هزينه ارسال :";
        tr_send_price.Controls.Add(td_stronger_lable);


        HtmlGenericControl td_stronger_price = new HtmlGenericControl("td");

        td_stronger_price.Attributes.Add("class", "stronger");
        HtmlGenericControl div_td_stronger_price = new HtmlGenericControl("div");

        div_td_stronger_price.Attributes.Add("class", "align-right");
        div_td_stronger_price.InnerText = sendprice + " ریال";
        td_stronger_price.Controls.Add(div_td_stronger_price);
        tr_send_price.Controls.Add(td_stronger_price);
        table_body_order.Controls.Add(tr_send_price);

        HtmlGenericControl tr_total_price = new HtmlGenericControl("tr");
        HtmlGenericControl td_stronger_lable_totalprice = new HtmlGenericControl("td");

        td_stronger_lable_totalprice.Attributes.Add("class", "stronger");
        td_stronger_lable_totalprice.InnerText = "جمع کل :";
        tr_total_price.Controls.Add(td_stronger_lable_totalprice);


        HtmlGenericControl td_stronger_totalprice = new HtmlGenericControl("td");

        td_stronger_totalprice.Attributes.Add("class", "stronger");
        HtmlGenericControl div_td_stronger_totalprice = new HtmlGenericControl("div");

        div_td_stronger_totalprice.Attributes.Add("class", "size-16 align-right");
        div_td_stronger_totalprice.InnerText = total_price + " ریال";
        td_stronger_totalprice.Controls.Add(div_td_stronger_totalprice);
        tr_total_price.Controls.Add(td_stronger_totalprice);
        table_body_order.Controls.Add(tr_total_price);


        table_order.Controls.Add(table_body_order);
        divcollapse_inner.Controls.Add(table_order);
    }
예제 #3
0
    public void set_related(string name, string id)
    {
        related.InnerHtml = "";
        products  p       = new products();
        DataTable dt      = new DataTable();
        category  cat     = new category();
        brand     brnd    = new brand();
        string    picname = null;

        // string brandname = null;

        dt = p.getproduct_related_top(name, id);;
        int i = 0;
        HtmlGenericControl divslide = null;
        HtmlGenericControl divrow   = null;

        if (dt.Rows.Count > 0)
        {
            //<div class="arrows">
            //            <a href="#" class="icon-chevron-right" id="featuredItemsRight"></a><a href="#" class="icon-chevron-left"
            //                id="featuredItemsLeft"></a>
            //        </div>


            HtmlGenericControl h = new HtmlGenericControl("h2");
            h.Attributes.Add("class", "title");

            HtmlGenericControl span = new HtmlGenericControl("span");
            span.Attributes.Add("class", "light");
            span.InnerText = "محصولات مرتبط";

            HtmlGenericControl divarrow = new HtmlGenericControl("div");
            divarrow.Attributes.Add("class", "arrows");

            HtmlGenericControl a_right_divarrow = new HtmlGenericControl("a");
            a_right_divarrow.Attributes.Add("class", "icon-chevron-right");
            a_right_divarrow.Attributes.Add("id", "featuredItemsRight");
            a_right_divarrow.Attributes.Add("href", "#");
            a_right_divarrow.ClientIDMode = ClientIDMode.Static;
            divarrow.Controls.Add(a_right_divarrow);

            HtmlGenericControl a_left_divarrow = new HtmlGenericControl("a");
            a_left_divarrow.Attributes.Add("class", "icon-chevron-left");
            a_left_divarrow.Attributes.Add("id", "featuredItemsLeft");
            a_left_divarrow.Attributes.Add("href", "#");
            a_left_divarrow.ClientIDMode = ClientIDMode.Static;
            divarrow.Controls.Add(a_left_divarrow);


            h.Controls.Add(span);

            title.Controls.Add(h);
            title.Controls.Add(divarrow);
        }


        foreach (DataRow dr in dt.Rows)
        {
            if (i % 3 == 0)
            {
                divslide = new HtmlGenericControl("div");
                divslide.Attributes.Add("class", "slide");
                divrow = new HtmlGenericControl("div");
                divrow.Attributes.Add("class", "row");
            }

            string catname   = cat.getcategory(dr["cat_id"].ToString()).Rows[0]["name"].ToString();
            string brandname = brnd.getbrandbyid(dr["brand_id"].ToString()).Rows[0]["name"].ToString();


            DataTable          pname    = p.getonepic(Convert.ToInt32(dr["id"]));
            HtmlGenericControl divspan4 = new HtmlGenericControl("div");
            divspan4.Attributes.Add("class", "span4");

            if (pname.Rows.Count != 0)
            {
                //imgpicture.Attributes.Add("src", "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg");
                picname = "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg";
            }
            else
            {
                //imgpicture.Attributes.Add("src", "images/Ppic/noimage.jpg");
                picname = "images/Ppic/noimage.jpg";
            }

            HtmlGenericControl divproduct = new HtmlGenericControl("div");
            divproduct.Attributes.Add("class", "product");


            HtmlGenericControl divproductimg = new HtmlGenericControl("div");
            divproductimg.Attributes.Add("class", "product-img featured");


            HtmlGenericControl divpicture = new HtmlGenericControl("div");
            divpicture.Attributes.Add("class", "picture");


            HtmlGenericControl imgpicture = new HtmlGenericControl("img");
            imgpicture.Attributes.Add("id", "p-img-f" + dr["id"].ToString());
            //img1.Attributes.Add("runat", "server");
            imgpicture.Attributes.Add("width", "518");
            imgpicture.Attributes.Add("height", "358");
            imgpicture.Attributes.Add("alt", "");

            imgpicture.Attributes.Add("src", picname);
            divpicture.Controls.Add(imgpicture);


            HtmlGenericControl divimgoverlay = new HtmlGenericControl("div");
            divimgoverlay.Attributes.Add("class", "img-overlay");


            HtmlGenericControl aimgoverlay = new HtmlGenericControl("a");
            aimgoverlay.Attributes.Add("href", "product.aspx?id=" + dr["id"].ToString());
            aimgoverlay.Attributes.Add("class", "btn more btn-primary");
            aimgoverlay.InnerText = "توضیحات بیشتر";
            divimgoverlay.Controls.Add(aimgoverlay);



            HtmlAnchor aimgoverlay2 = new HtmlAnchor();
            aimgoverlay2.ID           = "addtocart" + dr["id"].ToString();
            aimgoverlay2.HRef         = "#";
            aimgoverlay2.Name         = dr["id"].ToString() + "," + dr["price"].ToString() + "," + picname + "," + catname + " - " + brandname + " - " + dr["name"].ToString();
            aimgoverlay2.ServerClick += new System.EventHandler(Addcart_Click);
            aimgoverlay2.Attributes.Add("class", "btn buy btn-danger");
            aimgoverlay2.Attributes.Add("onclick", "addtocart('" + "p-img-f" + dr["id"].ToString() + "');");
            aimgoverlay2.InnerText = "اضافه به سبد خرید";

            UpdatePanel up = new UpdatePanel();
            up.ContentTemplateContainer.Controls.Add(aimgoverlay2);
            divimgoverlay.Controls.Add(up);
            divimgoverlay.Controls.Add(aimgoverlay);
            divpicture.Controls.Add(divimgoverlay);
            divproductimg.Controls.Add(divpicture);
            divproduct.Controls.Add(divproductimg);

            HtmlGenericControl divmaintitle = new HtmlGenericControl("div");
            divmaintitle.Attributes.Add("class", "main-titles");


            HtmlGenericControl h4maintitle = new HtmlGenericControl("h4");
            h4maintitle.Attributes.Add("class", "title");
            h4maintitle.InnerText = catname + "-" + brandname + " - " + dr["name"].ToString();
            divmaintitle.Controls.Add(h4maintitle);

            HtmlGenericControl h5maintitle = new HtmlGenericControl("h5");
            h5maintitle.Attributes.Add("class", "no-margin");
            h5maintitle.InnerText = String.Format("{0:#,##0}", dr["price"]) + " ریال"; //int.Parse(dr["price"].ToString()).ToString("N1",CultureInfo.InvariantCulture);
            divmaintitle.Controls.Add(h5maintitle);
            divproduct.Controls.Add(divmaintitle);

            HtmlGenericControl pdesc = new HtmlGenericControl("p");
            pdesc.Attributes.Add("class", "desc");
            pdesc.InnerText = dr["detail"].ToString();
            divproduct.Controls.Add(pdesc);

            divspan4.Controls.Add(divproduct);


            if (i % 3 < 3)
            {
                divrow.Controls.Add(divspan4);
                divslide.Controls.Add(divrow);
            }
            if (i % 3 == 2 || (i + 1) == dt.Rows.Count)
            {
                related.Controls.Add(divslide);
            }
            i++;
        }
    }
예제 #4
0
    public void set_newproduct()
    {
        category cat     = new category();
        brand    brnd    = new brand();
        string   picname = null;

        new_product.InnerHtml = "";
        products  p  = new products();
        DataTable dt = new DataTable();

        dt = p.getproduct_new();
        int i = 0;

        foreach (DataRow dr in dt.Rows)
        {
            DataTable          pname    = p.getonepic(Convert.ToInt32(dr["id"]));
            HtmlGenericControl divspan3 = new HtmlGenericControl("div");
            divspan3.Attributes.Add("class", "span3");

            if (pname.Rows.Count != 0)
            {
                picname = "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg";
            }
            else
            {
                picname = "images/Ppic/noimage.jpg";
            }

            string catname   = cat.getcategory(dr["cat_id"].ToString()).Rows[0]["name"].ToString();
            string brandname = brnd.getbrandbyid(dr["brand_id"].ToString()).Rows[0]["name"].ToString();

            HtmlGenericControl divproduct = new HtmlGenericControl("div");
            divproduct.Attributes.Add("class", "product");

            HtmlGenericControl divproductimg = new HtmlGenericControl("div");
            divproductimg.Attributes.Add("class", "product-img");

            HtmlGenericControl divpicture = new HtmlGenericControl("div");
            divpicture.Attributes.Add("class", "picture");

            HtmlGenericControl imgpicture = new HtmlGenericControl("img");
            imgpicture.Attributes.Add("id", "p-img-new" + dr["id"].ToString());
            imgpicture.Attributes.Add("width", "540");
            imgpicture.Attributes.Add("height", "374");
            imgpicture.Attributes.Add("alt", "");
            imgpicture.Attributes.Add("src", picname);
            divpicture.Controls.Add(imgpicture);

            HtmlGenericControl divimgoverlay = new HtmlGenericControl("div");
            divimgoverlay.Attributes.Add("class", "img-overlay");


            HtmlGenericControl aimgoverlay = new HtmlGenericControl("a");
            aimgoverlay.Attributes.Add("href", "product.aspx?id=" + dr["id"].ToString());
            aimgoverlay.Attributes.Add("class", "btn more btn-primary");
            aimgoverlay.InnerText = "توضیحات بیشتر";
            divimgoverlay.Controls.Add(aimgoverlay);



            HtmlAnchor aimgoverlay2 = new HtmlAnchor();
            aimgoverlay2.ID           = "addtocart" + dr["id"].ToString();
            aimgoverlay2.HRef         = "#";
            aimgoverlay2.Name         = dr["id"].ToString() + "," + dr["price"].ToString() + "," + picname + "," + catname + " - " + brandname + " - " + dr["name"].ToString();
            aimgoverlay2.ServerClick += new System.EventHandler(Addcart_Click);
            aimgoverlay2.Attributes.Add("class", "btn buy btn-danger");
            aimgoverlay2.Attributes.Add("onclick", "addtocart('" + "p-img-new" + dr["id"].ToString() + "');");
            aimgoverlay2.InnerText = "اضافه به سبد خرید";

            UpdatePanel up = new UpdatePanel();
            up.ContentTemplateContainer.Controls.Add(aimgoverlay2);
            divimgoverlay.Controls.Add(up);
            divimgoverlay.Controls.Add(aimgoverlay);
            divpicture.Controls.Add(divimgoverlay);
            divproductimg.Controls.Add(divpicture);
            divproduct.Controls.Add(divproductimg);

            HtmlGenericControl divmaintitle = new HtmlGenericControl("div");
            divmaintitle.Attributes.Add("class", "main-titles no-margin");


            HtmlGenericControl h4maintitle = new HtmlGenericControl("h4");
            h4maintitle.Attributes.Add("class", "title");
            h4maintitle.InnerText = catname + " - " + brandname + " - " + dr["name"].ToString();
            divmaintitle.Controls.Add(h4maintitle);

            HtmlGenericControl h5maintitle = new HtmlGenericControl("h5");
            h5maintitle.Attributes.Add("class", "no-margin");
            h5maintitle.InnerText = String.Format("{0:#,##0}", dr["price"]) + " ریال"; //int.Parse(dr["price"].ToString()).ToString("N1",CultureInfo.InvariantCulture);
            divmaintitle.Controls.Add(h5maintitle);
            divproduct.Controls.Add(divmaintitle);

            HtmlGenericControl pdesc = new HtmlGenericControl("p");
            pdesc.Attributes.Add("class", "desc");
            pdesc.InnerText = dr["detail"].ToString();
            divproduct.Controls.Add(pdesc);

            divspan3.Controls.Add(divproduct);

            new_product.Controls.Add(divspan3);
            if (i != 0 && i % 3 == 0)
            {
                HtmlGenericControl divclearfix = new HtmlGenericControl("div");
                divclearfix.Attributes.Add("class", "clearfix");
                new_product.Controls.Add(divclearfix);
            }
            i++;
        }
    }