コード例 #1
0
        protected void rptSkuItem_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            List <SkuShipping> skuItems = ShippingDAL.GetSkuShipping(false, DefaultSitePrefereceId);

            CSBusiness.Sku skuItem = e.Item.DataItem as CSBusiness.Sku;

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label   lblTitle      = e.Item.FindControl("lblSkuTitle") as Label;
                Label   lblSkuId      = e.Item.FindControl("lblSkuId") as Label;
                TextBox txtPercentage = (TextBox)e.Item.FindControl("txtPercentage");

                SkuShipping itemVal = skuItems.FirstOrDefault(p => p.SkuId == skuItem.SkuId);
                if (itemVal != null)
                {
                    txtPercentage.Text = String.Format("{0:0.##}", itemVal.Cost);
                }
                else
                {
                    txtPercentage.Text = "0";
                }
                lblSkuId.Text = skuItem.SkuId.ToString();
                lblTitle.Text = skuItem.Title + " (" + skuItem.SkuId.ToString() + ")";
            }
        }