easyui combobox 动态加载数据C#
<script type="text/javascript" src="Scripts/jquery-1.8.2.min.js"></script>
<link type="text/css" rel="Stylesheet" href="jquery-easyui-1.6.11/themes/default/easyui.css" />
<link type="text/css" rel="Stylesheet" href="jquery-easyui-1.6.11/themes/icon.css" />
<script type="text/javascript" src="jquery-easyui-1.6.11/jquery.min.js"></script>
<script type="text/javascript" src="jquery-easyui-1.6.11/jquery.easyui.min.js"></script>
<script type="text/javascript">
$(function () { $.ajax({
type: "Post",
url: "easyuiComboBox.aspx/GetBrowser",
// data: "{}",
contentType: "application/json;charset=utf-8",
dataType: "json",
success: function (data) { $('#first_catalogue').combobox({
data: eval(data.d), //eval(data.d)将JSON的字符串解析成JSON数据格式
valueField: 'value',
textField: 'text',
groupField: 'group',
required: true,
editable: false,
onLoadSuccess: function () {
//加载完成后,设置选中第一项
var val = $(this).combobox("getData");
//设置第一个值为选中值
$(this).combobox("select", val[0].text);
},
onChange: function () { //getValue,getText分别获取value值,text
var val = $('#first_catalogue').combobox("getText"); alert(val);
}
}); },
error: function (err) {
alert(JSON.parse(err.responseText).Message);
}
}); });
</script>
html
<input class="easyui-combobox" id="first_catalogue" style="width: 30%;" value="--请选择所属分类--">
后台代码
[WebMethod]
public static string GetBrowser()
{
string json = "[{\"value\":\"f20\",\"text\":\"Firefox 2.0 or higher\",\"group\":\"Firefox\"}" +
",{\"value\":\"f15\",\"text\":\"Firefox 1.5.x\",\"group\":\"Firefox\"}," +
"{\"value\":\"f10\",\"text\":\"Firefox 1.0.x\",\"group\":\"Firefox\"}," +
"{\"value\":\"ie7\",\"text\":\"Microsoft Internet Explorer 7.0 or higher\",\"group\":\"Microsoft Internet Explorer\"}" +
",{\"value\":\"ie6\",\"text\":\"Microsoft Internet Explorer 6.x\",\"group\":\"Microsoft Internet Explorer\"}]";
return json; //List<Browser> browsers=new List<Browser>();
//Browser b= new Browser();
//b.value ="f20";
//b.text ="Firefox 2.0 or higher";
//b.group="Firefox";
//browsers.Add(b);
//JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
//return jsSerializer.Serialize(browsers);
}
显示效果

easyui combobox 动态加载数据C#的更多相关文章
- easyui combobox 动态加载数组数据
怕自己忘了,记录下来以后用方便 html部分 <input id="rzcode" name="businesItemId" style="wi ...
- easyui datagrid 动态加载数据 渲染问题,表格错位问题
$('#dg').datagrid({ url:'datagrid_data.json', columns:[[ {field:'code',title:'Code',width:100}, {fie ...
- easyui combobox 动态加载的两种方法
reload 方法 javascript代码 //指定id 和 text 否则始终选择第一个 $('#contact_city').combobox({ valueField:'id', textFi ...
- extjs Combobox动态加载数据问题,mode:local 还是remote
var fabircTypeDs = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'province.do' }), reade ...
- 42.extjs Combobox动态加载数据问题,mode:local 还是remote
问题: Java代码 var fabircTypeDs = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'province. ...
- Easyui combobox 怎么加载数据
说明:开发环境 vs2012 asp.net mvc4 c# 1.效果图 2.HTML代码 <%@ Page Language="C#" AutoEventWireup=&q ...
- AppCan学习笔记----关闭页面listview动态加载数据
AppCan页面关闭 AppCan 的页面是由两个HTML组成,如果要完全关闭的话需要在主HTML eg.index.html中关闭,关闭方法:appcan.window.close(-1); 管道 ...
- [JS前端开发] js/jquery控制页面动态加载数据 滑动滚动条自动加载事件
页面滚动动态加载数据,页面下拉自动加载内容 相信很多人都见过瀑布流图片布局,那些图片是动态加载出来的,效果很好,对服务器的压力相对来说也小了很多 有手机的相信都见过这样的效果:进入qq空间,向下拉动空 ...
- 微信小程序(五) 利用模板动态加载数据
利用模板动态加载数据,其实是对上一节静态数据替换成动态数据:
随机推荐
- CentOS开机自启动/etc/rc.local不执行的解决办法
放置在开机自启动里面没有自动启动 查看文件/etc/rc.local发现是一个软连接 修改源文件的执行权限即可 chmod 755 /etc/rc.d/rc.local 查看日志可以看到开机自启动过程 ...
- Ansible自动化运维之介绍安装与简单使用
参考:http://blog.51cto.com/191226139/2066936 Ansible是什么 Ansible 简单的说是一个配置管理系统(configuration management ...
- ad 层次绘图遇到的元件堆积问题
元器件复用一般我们使用 reapeat 来复用 总线形式引出各个引脚,有时候我们也可以通过简单的复制实现.但是注意上图 原理图作为一个元件使用,他和单个元件一样必须有唯一ID,名字,不然也会出现冲突, ...
- mysql 超时时间
小结: 1.mysql服务端主动关闭链接的秒数: MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variables https: ...
- docker disable restart--run privileged
--restart=unless-stopped option, as @Shibashis mentioned, or update the restart policy (this require ...
- [daily][editer] 二进制编辑工具 hyx
用了众多之后,终于发现了一个好用的二进制编辑工具: hyx https://yx7.cc/code/ https://en.wikipedia.org/wiki/Comparison_of_hex_e ...
- Adobe Flex初记
公司项目要用Flex,之前没有接触过,菜鸟只好白手起家,把项目拉下来的同时配置下Flex的环境,以下是一篇参考: http://blog.sina.com.cn/s/blog_4c4a24db0100 ...
- PLSQL游标
静态游标:结果集已经确实(静态定义)的游标.分为隐式和显式游标 隐式游标:所有DML语句为隐式游标,通过隐式游标属性可以获取SQL语句信息: 显式游标:用户显式声明的游标,即指定结果集.当查询返回结果 ...
- Gson使用技巧
1. CharMatcher String serviceUrl = CharMatcher.is('/').trimTrailingFrom(ConfigHelper.metaServiceUrl( ...
- tensorflow入门笔记(四) tf.summary 模块
模块内的函数: tf.summary.audio(name, tensor, sample_rate, max_outputs=3, collections=None, family=None) 输出 ...