void BindGroupList()
    {
        List <string> groups = ProductBrands.GetBrandGroup();

        ddlBrandGroup.Items.Clear();
        ddlBrandGroup.Items.Add(new ListItem("新建分组"));
        newGroupRow.Style.Clear();
        groupSelectRow.Style.Clear();
        if (groups == null || groups.Count == 0)
        {
            //newGroupRow.Style.Clear();
            //groupSelectRow.Style.Clear();
            groupSelectRow.Style.Add("visibility", "hidden");
            groupSelectRow.Style.Add("position", "absolute");
        }
        else
        {
            newGroupRow.Style.Add("display", "none");
            foreach (string group in groups)
            {
                ddlBrandGroup.Items.Add(new ListItem(group));
                if (ddlBrandGroup.Items.Count == 2)
                {
                    ddlBrandGroup.SelectedItem.Selected = false;
                    ddlBrandGroup.Items[1].Selected     = true;
                }
            }
        }
    }
示例#2
0
        string RenderHTML()
        {
            List <ProductBrand> brands = ProductBrands.GetProductBrands();

            string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-brand";

            if (brands == null || brands.Count == 0)
            {
                return("<div><span>没有显示的品牌信息!</span></div>");
            }
            List <string> brandGroup = ProductBrands.GetBrandGroup();
            int           curCount   = brandGroup.Count;

            brandGroup = brandGroup.GetRange(0, Math.Min(_Max, curCount));
            List <ProductBrand> pb = null;
            StringBuilder       sb = new StringBuilder();

            sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">");
            string bId = string.Empty;

            for (int i = 0; i < brandGroup.Count; i++)
            {
                if (i % _Columns == 0)
                {
                    sb.AppendLine("<tr>");
                }

                sb.AppendLine("<td>");
                sb.AppendLine("<div><div><a href=\"javascript:void(0)\">" + brandGroup[i] + "</a></div></div>");
                pb = GetSubBrand(brandGroup[i], brands);
                ProductBrand _pb = null;
                for (int j = 0; j < pb.Count; j++)
                {
                    _pb = pb[j];
                    bId = GlobalSettings.Encrypt(_pb.BrandID.ToString());
                    sb.AppendLine("<a href=\"" + nav + "&ID=" + bId + "\" target=\"_blank\">" + _pb.BrandName + "</a>");
                    if (j != pb.Count - 1)
                    {
                        sb.Append("&nbsp;|&nbsp;");
                    }
                }
                sb.AppendLine("</td>");

                if (i % _Columns == _Columns - 1)
                {
                    sb.AppendLine("</tr>");
                }
            }
            sb.AppendLine("</table>");

            if (curCount > _Max)
            {
                sb.Append("<div class=\"list-more\"><a href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-brand\" title=\"查看全部。。。\"></a></div>");
            }
            return(sb.ToString());
        }