zoukankan      html  css  js  c++  java
  • EasyUI combobox加入请选择 [.net后台代码]

    判空D一种方式:

           var sValue = $('#selGlade').combobox('getValue');
           if (sValue == "") {
                  $.messager.alert("错误", "请选择年级!","info");
                  return false;
           }

    加入 请选择:

    前端方法:
        var DicHandler = "....";       function Combobox(id, type) {        $('#' + id).combobox({        url: DicHandler + "&type=" + type,        valueField: 'value',        textField: 'text',        130        });       }

    后台代码:
           public static List<ComboItem> ComboBox(DataSet ds, string value, string text, bool flag)
            {
                List<ComboItem> lst = new List<ComboItem>();
                ComboItem item = new ComboItem();
                if (flag)
                {
                    item.text = "<-- 请选择 -->";
                    item.value = "";
                    lst.Add(item);
                }
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    ComboItem items = new ComboItem();
                    items.value= dr[value].ToString();
                    items.text = dr.ToString();
                    lst.Add(items);
                }
                return lst;
            }
    
    
         public class ComboItem {
              public string id { get; set; }
              public string text { get; set; }
         }
     
         context.Response.Write(JsonConverter.Parse(EasyJson.ComboBox(ds, "Id", "GradeName", true)));
    

    web技术分享

    http://www.kuaipao8.com
  • 相关阅读:
    ubuntu nginx 伪静态 设置
    ubuntu thinkphp pathinfo 404等问题
    ubuntu svn安装测试
    ubuntu zendDebugger.so 加载不上的问题
    ubuntu ssh安装
    nyoj-660-逃离地球
    nyoj-643-发短信
    nyoj-181-小明的难题
    nyoj-663-弟弟的作业
    nyoj-682-初学者的烦恼
  • 原文地址:https://www.cnblogs.com/youqu/p/3123687.html
Copyright © 2011-2022 走看看