public static MvcHtmlString GetAllPhoneBoardList(this HtmlHelper htmlHelper, string name, string selectedValue) { IEnumerable <CommonIDName> group = BaseDataBLL.GetPhoneBoard(); string option = ""; string alloptgroup = ""; foreach (CommonIDName item in group) { if (selectedValue == item.Name) { option += " <option selected='selected' value = '" + item.Name + "' > " + item.Name + " </option >"; } else { option += " <option value = '" + item.Name + "' > " + item.Name + " </option >"; } } alloptgroup += option; alloptgroup = "<select style = 'width: 100 %;' class='select2' id=" + name + " name=" + name + ">" + "<option value='all_brand'> 所有品牌</option>" + alloptgroup + "</select>"; return(new MvcHtmlString(alloptgroup)); }