예제 #1
0
        public static MvcHtmlString DictDropdownList(this HtmlHelper html, string name, string dictCode, DictValueType dictValueType, object selectedValue, object htmlAttributes)
        {
            ISysManageService service    = ObjectFactory.GetInstance <ISysManageService>();
            List <DictInfo>   dictlsit   = service.GetChildDictInfos(dictCode);
            string            valueField = "";

            if (dictValueType == DictValueType.DictName)
            {
                valueField = "DictName";
            }
            else if (dictValueType == DictValueType.DictCode)
            {
                valueField = "DictCode";
            }
            else
            {
                valueField = "DictID";
            }
            SelectList list = new SelectList(dictlsit, valueField, "DictName", selectedValue);

            return(html.DropDownList(name, list, htmlAttributes));
        }