Mình đang làm đồ án 1 site bán hàng nhỏ, hiện mình đang xây dựng giỏ hàng cho phép đưa sản phẩm vào giỏ hàng. Hàm thêm sản phẩm vào giỏ hàng bao gồm mã sản phẩm + thuộc tính của sản phẩm (màu sắc, kích thước ..)
Mình có tạo 1 trang chi tiết sản phẩm, chứa thông tin chi tiết sản phẩm.
Vấn đề của mình là:
1)LinkButton đưa sản phẩm vào giỏ hàng không click được, mình add thêm thuộc tính CauseValidation=false thì thêm được sản phẩm vào giỏ hàng, trong khi trong file aspx không có 1 control validation nào cả. Ai biết thì giải thích dùm mình nhé.
2)Trọng sự kiện click của LinkButton giỏ hàng mình muốn lấy các thuộc tính của các Control trong PlaceHolder được tạo ra trong Page_load. Nhưng khi debug thì không khi sự kiện click của LinkButton xảy ra trong PlaceHolder này không chứa bất kì control nào. Bạn nào có thể chỉ cho mình làm sao để lấy được các giá trị trong các control thuộc PlaceHolder này được không?
Sau đây là code của trang này. Mình làm theo cuốn "Beginning ASP.NET E-Commerce in C# from novice to pro"-chương 13 trong đó. Có bạn nào đã đọc là biết liền.
Cảm ơn bạn rất nhiềul

Mã:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProductDetail.ascx.cs" Inherits="smartphone.UserControls.ProductDetail"%>
<%@ Import Namespace="smartphone.App_Code" %>
<%@ Register Src="~/UserControls/CommentsBlock.ascx" TagPrefix="uc1" TagName="CommentsBlock" %>
<%@ Register Src="~/UserControls/CommentForm.ascx" TagPrefix="uc1" TagName="CommentForm" %>



<script src="../Scripts/jquery-1.8.3.js"></script>
<%--pika choose--%>
<script src="../Scripts/PikaChoose/jquery.pikachoose.full.js"></script>
<script src="../Scripts/PikaChoose/jquery.jcarousel.min.js"></script>

<link href="../Styles/PikaChoose/bottom.css" rel="stylesheet" />
<link href="../App_Themes/ESmartDefaultTheme/ESmart.css" rel="stylesheet" />
<%--goi cloud zoom chay hieu ung zoom--%> 
<script type="text/javascript">
    $(document).ready(
        function () {
            $("#pikame").PikaChoose({ carousel: true, carouselOptions: { wrap: 'circular' } });

            //CloudZoom.quickStart();
    });
</script>   

<style>
    #image-zoom-small {
        width: 64px;
        height: 80px;
    }
</style>

<div    

    <%--album hinh anh cua cua san pham--%>
    <div        <div id="productDetailImages" runat="server"            <ul id="pikame"            <asp:Repeater ID="productImageItems" runat="server">
                <ItemTemplate>
                     <li>
                         <a>
                             [IMG]<%#LinkClass.ToProductImage(Eval([/IMG]"/>
                         </a>
                     </li>
                </ItemTemplate>
            </asp:Repeater>
            </ul>
        </div>
    </div>

    <div        <div id="shortDescription" runat="server"        <div            <a href="#">Chi tiết</a>
        </div>

        <div 
                Giá: 
                
            </div>

        <div       //PlaceHoldler để chứa các thuộc tính của sản phẩm, các thuộc tính sẽ được load trong sự kiện Page_load
            <div                <asp:PlaceHolder ID="PlaceHolderAttributes" runat="server"></asp:PlaceHolder>
            </div>[/COLOR]

            <asp:Label CssID="LabelPromotion" runat="server" Text="Khuyến mại" Visible="false"></asp:Label>

            <div id="buyBlock" runat="server"            </div>
            Giỏ hàng</asp:LinkButton>[/COLOR]
            
        </div>

        <div            <strong style="float: left; margin: 5px;">Chia sẻ: </strong>
			<!-- AddThis Button BEGIN -->
			<div addthis_default_style addthis_32x32_style">
			<a addthis_bubble_style"></a>
			</div>
			<script type="text/javascript">var addthis_config = { "data_track_addressbar": true };</script>
			<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-50a0aa0b267c0f77"></script>
			<!-- AddThis Button END -->
        </div>
    </div>

        <div href="#idtab1" id="moreInfoIabsInfomation">Giới thiệu</a></li>
				<li><a href="#idtab2" id="MoreInfoTabsData">Thông tin</a></li>
			</ul>
		    <div id ="more-info-sheets">
			    <div id="idtab1">
				    <p id="productDetailDescriptionFull" runat="server"></p>
			    </div>
			    <div id="idtab2">
				    <ul>
					    <li id="productDetailManufacturer" runat="server"></li>
                        <li id="productDetailAccessory" runat="server"></li>
                        <li id="productDetailWarranty" runat="server"></li>
                        <li id="productDetailOS" runat="server"></li>
                        <li id="productDetailCpu" runat="server"></li>
                        <li id="productDetailCamera" runat="server"></li>
                        <li id="productDetailWifi" runat="server"></li>
                        <li id="productDetailAudio" runat="server"></li>
                        <li id="productDetailSensor" runat="server"></li>
                        <li id="productDetailMovie" runat="server"></li>
				    </ul>
			    </div>
		    </div>
	    </div>

</div>
<%--Comment ve san pham nay--%>
<uc1:CommentsBlock runat="server" ID="CommentsBlock" />

<%--Khung nhap comment--%>
<uc1:CommentForm runat="server" ID="CommentForm" />
Đây là codebehind của nó

Mã:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using smartphone.App_Code;

namespace smartphone.UserControls
{
    public partial class ProductDetail : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["ProductId"];
            if (id != null)
            {
                PopulateContol(id);
            }
        }

        /// <summary>
        /// Lay thong tin chi tiet san pham
        /// </summary>
        /// <param name="id"></param>
        private void PopulateContol(string id)
        {
            Product product = new Product();
            product = product.GetProductDetail(Int32.Parse(id));
            DataTable tableAlbum = product.GetProductAlbum(Int32.Parse(id));
            //lay ra album hinh anh dua vao slide show
            productImageItems.DataSource = tableAlbum;
            productImageItems.DataBind();

            //ten san pham
            productName.InnerHtml = product.ProductName;

            //gioi thieu ngan
            shortDescription.InnerText =  product.ProductDesciption.Substring(0, 120) + "...";

            //gia san pham
            double tempMoney = product.ProductPrice;
            productDetailPrice.InnerText = String.Format("{0:0,0}", tempMoney) + " vnđ";

            //so luong san pham hien con
            if (product.ProductQuantity > 0)
            {
                buyBlock.InnerText = "Tình trạng: còn hàng.";
            }
            else
            {
                buyBlock.InnerText = "Tình trạng: hết hàng.";
            }

            if (product.Promotion != "")
            {
                LabelPromotion.Visible = true;
                LabelPromotion.Text = product.Promotion;
            }

            //mo ta day du ve san pham
            productDetailDescriptionFull.InnerText = product.ProductDesciption;

            //tab2 chua thong tin ki thuat ve san pham
            productDetailManufacturer.InnerText = "Hãng sản xuất: " + product.ManufacturerName;
            productDetailAccessory.InnerText = "Phụ kiện: " + product.ProductAccessory;
            productDetailWarranty.InnerText = "Thời gian bảo hành: " + product.ProductWarranty.ToString() + " tháng";
            productDetailOS.InnerText = "Hệ điều hành: " + product.ProductOS;
            productDetailCpu.InnerText = "Cpu: " +  product.ProductCPU.ToString() + " Ghz";
            productDetailCamera.InnerText = "Máy ảnh: " + product.ProductCamera.ToString() + " megapixel";
            productDetailWifi.InnerText = "Wifi: " + product.ProductWifi;
            productDetailAudio.InnerText = "Định dạng nghe nhạc: " + product.ProductAudio;
            productDetailSensor.InnerText = "Cảm ứng: " + product.ProductSensor;
            productDetailMovie.InnerText = "Định dạng video: " + product.ProductMovie;

            //lay thong tin ve cac thuoc tinh cua san pham va dua vao PlaceHOlder
            DataTable attrTable = product.GetProductAttributes(Int32.Parse(id));

            string prevAttr = "";
            string attrName, attrValue, attrValueId;

            Label attrNameLabel;
            DropDownList attrValueDropDownList = new DropDownList();

            foreach (DataRow row in attrTable.Rows)
            {
                attrName = row["tenThuocTinh"].ToString();
                attrValue = row["giaTriThuocTinh"].ToString();
                attrValueId = row["maGiaTriThuocTinh"].ToString();

                //1 san pham co the co nhieu thuoc tinh, mau sac, kich thuoc, ...
                if (attrName != prevAttr)
                {
                    prevAttr = attrName;
                    attrNameLabel = new Label();
                    attrNameLabel.Text = attrName;

                    attrValueDropDownList = new DropDownList();
                    PlaceHolderAttributes.Controls.Add(attrNameLabel);
                    PlaceHolderAttributes.Controls.Add(attrValueDropDownList);
                }
                //them cac gia tri thuoc tinh vao dropdownlist
                attrValueDropDownList.Items.Add(new ListItem(attrValue, attrValueId));
            }

        }


        /// <summary>
        /// Su kien dua san pham vao gio hang
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void LinkButtonToCart_Click(object sender, EventArgs e)
        {
            //lay ma san pham hien dang xem chi tiet
            string id = Request.QueryString["ProductId"];
            string options = "";

            //Lay gia tri cua thuoc tinh bang cach duyet qua cac control tren placeholder
            foreach (Control ctr in PlaceHolderAttributes.Controls)
            {
                //lay ten loai thuoc tinh
                if (ctr is Label)
                {
                    Label lb = (Label)ctr;
                    options += lb.Text;
                }
                //lay gia tri cua thuoc tinh
                if (ctr is DropDownList)
                {
                    DropDownList dr = (DropDownList)ctr;
                    options += dr.Items[dr.SelectedIndex] + "; ";
                }
            }

            ShoppingCart shop = new ShoppingCart();
            shop.AddItem(id, options);
        }
    }
}