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空间,向下拉动空 ...
- 微信小程序(五) 利用模板动态加载数据
利用模板动态加载数据,其实是对上一节静态数据替换成动态数据:
随机推荐
- 在moveit编译时找不到manipulation_msgsConfig.cmake manipulation_msgs-config.cmake文件
这是由于少了manipulation_msgs这个包 我们在这里安装这个包就好了 在终端中输入 sudo apt-get install ros-kinetic-manipulation-msgs
- 一、SQL定义变量
http://blog.csdn.net/changwei07080/article/details/7561602 在SQL我们使用declare定义局部变量,同时可以使用set和select 对变 ...
- centos 安装教程 服务器配置教程 服务器中安装python 服务器中安装Django 安装MySQL 配置MySQL
一 .解决python编译安装所需的软件依赖 yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel opens ...
- 关于ti环境搭建 IAR 为什么IAR不能跳转的真正原因
1.IAR工程莫名其妙的错误,可以通过复制工程文件来解决 2.cc2540环境配置,尽量默认到c盘,以便解决不必要的麻烦,另外,不同的库尽量安装对应的环境文件,比如freertos等环境 3.对于蓝牙 ...
- CH 4701 - 天使玩偶 - [CDQ分治]
题目链接:传送门 关于CDQ分治(参考李煜东<算法竞赛进阶指南>): 对于一系列操作,其中的任何一个询问操作,其结果必然等价于:初始值 + 此前所有的修改操作产生的影响. 假设共有 $m$ ...
- BZOJ 3224 - 普通平衡树 - [Treap][Splay]
题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=3224 Description 您需要写一种数据结构(可参考题目标题),来维护一些数,其中 ...
- [No0000190]vim8安装教程和vim中文帮助文档Vimcdoc安装方法-Vim使用技巧(5)
Vim8.0是近十年来的一次大更新,支持任务.异步I/O.Channels和JSON以及异步计时器.Lambdas 和 Closures等,还包括对GTK + 3的支持.由于ubuntu默认安装的Vi ...
- Yarn && npm设置镜像源
安装yarn npm i -g yarn yarn yarn config set registry https://registry.npm.taobao.org --global yarn con ...
- arcengine新建要素类
ArcGIS里面新建数据集,看起来简单,平时都是默认创建,实际上好多细节问题我们都没注意到 一.在数据集上新建要素类: How to create a feature class within a f ...
- html select控件的jq操作
html select控件的jq操作 1.判断select选项中 是否存在Value="paraValue"的Item $("#selectid option[@valu ...