コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ProductList.ItemStyle.Width = new System.Web.UI.WebControls.Unit(100 / this.Columns, System.Web.UI.WebControls.UnitType.Percentage);
            var products = ProductDataSource.GetProductSpecials(this.MaxItems, 0);

            if (products != null && products.Count > 0)
            {
                if (!string.IsNullOrEmpty(this.Caption))
                {
                    CaptionLabel.Text = this.Caption;
                }
                ProductList.RepeatColumns = this.Columns;
                ProductList.DataSource    = products;
                ProductList.DataBind();
            }
            else
            {
                this.Visible = false;
            }
        }