private void LoopItems(DictionaryItem item, XhtmlTextWriter writer) { switch (htmlTagName.ToLower().Trim()) { case "select": writer.WriteBeginTag("option"); writer.WriteAttribute("value", item.Key); if (IsSelected(item.Key)) { writer.WriteAttribute("selected", "selected"); } writer.Write(HtmlTextWriter.TagRightChar); int d = item.Depth; if (!String.IsNullOrEmpty(parentId)) { d -= parentId.Length / (provider == "category" ? Categories.Category.CATEGORY_LEVEL_LENGTH : DictionaryItem.KEY_LEVEL_LENGTH); } string text = BrandQQ.LeadLib.Utils.Util.RepeatString(identChar, (ushort)d); if (d > 0) { text += prefixChar; } writer.Write(text + item.Value); writer.WriteEndTag("option"); break; case "ul": writer.WriteBeginTag("li"); writer.WriteAttribute("id", "LI_" + this.ClientID + "_" + item.Key); writer.Write(HtmlTextWriter.TagRightChar); if (!String.IsNullOrEmpty(checkBoxOrRadio))//����ѡ�� { writer.WriteBeginTag("input"); writer.WriteAttribute("type", checkBoxOrRadio); writer.WriteAttribute("id", this.ClientID + "_" + item.Key); if (String.IsNullOrEmpty(htmlControlName)) { writer.WriteAttribute("name", this.ClientID); } else { writer.WriteAttribute("name", htmlControlName); } writer.WriteAttribute("value", item.Key); if (IsSelected(item.Key)) { writer.WriteAttribute("checked", "checked"); } writer.Write(HtmlTextWriter.SelfClosingTagEnd); writer.WriteBeginTag("label"); writer.WriteAttribute("for", this.ClientID + "_" + item.Key); writer.Write(HtmlTextWriter.TagRightChar); writer.Write(item.Value); writer.WriteEndTag("label"); } else { if (!String.IsNullOrEmpty(linkFormat)) { writer.Write(String.Format(linkFormat, item.Key, item.Value)); } else { writer.Write(item.Value); } } writer.WriteEndTag("li"); break; } if (item.Children.Count > 0 && htmlTagName.ToLower().Trim() == "ul") { writer.WriteFullBeginTag("ul"); } foreach (DictionaryItem subItem in item.Children) { LoopItems(subItem, writer); } if (item.Children.Count > 0 && htmlTagName.ToLower().Trim() == "ul") { writer.WriteEndTag("ul"); } }