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空间,向下拉动空 ...
- 微信小程序(五) 利用模板动态加载数据
利用模板动态加载数据,其实是对上一节静态数据替换成动态数据:
随机推荐
- 项目()已配置为使用IIS Web服务器,但此计算机上...
问题:x 就是要将一个项目,配置在IIS上,以前没遇上过这种开发模式啊... 解决方案: 0.如果配置为不使用IIS Web服务器,将Project.csproj中的" <UseIIS ...
- java整形数据和浮点型数据
在定义数据的时候,如果有不是整形的数据(单精度,双精度之类的),那么运算的时候要在其所在式子里的数据后面加上.0,否则会出现(1/2=0.1.0/2=0.5)的现象,比如如下代码 public cla ...
- [No0000162]如何不靠运气致富|来自硅谷著名天使投资人的40条致富经
1. Seek wealth, not money or status. Wealth is having assets that earn while you sleep. Money is how ...
- 网站性能优化实战——从12.67s到1.06s的故事
文章摘自https://juejin.im/post/5b0b7d74518825158e173a0c 作为互联网项目,最重要的便是用户体验.在举国“互联网+”的热潮中,用户至上也已经被大多数企业所接 ...
- confd
1.下载安装confd ]# wget https://github.com/kelseyhightower/confd/releases/download/v0.15.0/confd-0.15.0- ...
- 一个DRAM的存储单元存储的是0还是1取决于电容是否有电荷,有电荷代表1,无电荷代表0。
小结: 1.一个DRAM的存储单元存储的是0还是1取决于电容是否有电荷,有电荷代表1,无电荷代表0. https://baike.baidu.com/item/随机存取存储器/4099402?fr=a ...
- [skill][funny] 一个很厉害的for循环
int DSSL_MoveServerToMissingKeyList( DSSL_Env* env, DSSL_ServerInfo* si ) { DSSL_ServerInfo** new_se ...
- 【PyQt5-Qt Designer】日历(QCalendarWidget)
日历(QCalendarWidget)+爬虫API调用+自定义发送信号(传入2个参数) 总体介绍 QCalendarWidget类提供了一个基日历小部件,允许用户选择一个日期. 该小部件使用当前的月份 ...
- python pip install 报错TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' Command "python setup.py egg_info" failed with error code 1 in
pip install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl ...
- Docker 架构(四)
Docker 使用客户端-服务器 (C/S) 架构模式,使用远程 API 来管理和创建 Docker 容器. Docker 容器通过 Docker 镜像来创建. 容器与镜像的关系类似于面向对象编程中的 ...