void RenderJsonData() { List <ProductCategory> pcs = ProductCategories.GetCategoreisByProductID(productID); StringBuilder sb1 = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); foreach (ProductCategory pc in pcs) { sb1.AppendFormat("[{0}]:", pc.CategoryID); sb2.AppendFormat(catHtml, pc.CategoryID, pc.CategoryName); } hfCategories.Value = sb1.ToString(); hfCatHTML.Value = sb2.ToString(); sb1 = new StringBuilder(); sb2 = new StringBuilder(); List <ProductIndustry> pis = ProductIndustries.GetIndustriesByProductID(productID); foreach (ProductIndustry pi in pis) { sb1.AppendFormat("[{0}]:", pi.IndustryID); sb2.AppendFormat(indHtml, pi.IndustryID, pi.IndustryName); } hfIndustries.Value = sb1.ToString(); hfIndHTML.Value = sb2.ToString(); }
void BindIndustries() { List <ProductIndustry> pis = ProductIndustries.GetIndustriesByProductID(productID); string ids = string.Empty; string ns = string.Empty; foreach (ProductIndustry p in pis) { ids += "[" + p.IndustryID + "]"; ns += "<li rel='" + p.IndustryID + "' title='" + p.IndustryTitle + "'>" + p.IndustryName + "<a title='删除' href='javascript:void(0)' > </a>" + "</li>"; } hfTrade.Value = ids; hfTradeList.Value = ns; }
void BindIndustry(int pId) { List <ProductIndustry> pi = ProductIndustries.GetIndustriesByProductID(pId); if (pi.Count == 0) { ltIndustry.Text = "<ul><li><span>——</span></li></ul>"; } else { StringBuilder sb = new StringBuilder(); sb.Append("<ul>"); foreach (ProductIndustry p in pi) { sb.Append("<li><a target=\"_blank\" href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry&ID=" + GlobalSettings.Encrypt(p.IndustryID.ToString()) + "\">" + p.IndustryName + "</a></li>"); } ltIndustry.Text = sb.ToString(); } }