コード例 #1
0
        private void GetJsonForCombobox(HttpContext context)
        {
            string enumCode = context.Request.QueryString["enumCode"];

            SysEnum seBll = new SysEnum();
            var     dic   = seBll.GetKeyValueByParent(enumCode);

            if (dic == null || dic.Count() == 0)
            {
                context.Response.Write("[]");
            }

            string json = "";

            foreach (var kvp in dic)
            {
                json += "{\"id\":\"" + kvp.Key + "\",\"text\":\"" + kvp.Value + "\"},";
            }

            context.Response.Write("[" + json.Trim(',') + "]");
        }