惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 【当耐特】
Help Net Security
Help Net Security
P
Proofpoint News Feed
J
Java Code Geeks
爱范儿
爱范儿
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Full Disclosure
Google DeepMind News
Google DeepMind News
H
Help Net Security
G
Google Developers Blog
Jina AI
Jina AI
Vercel News
Vercel News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
Lohrmann on Cybersecurity
S
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
Security Archives - TechRepublic
Security Archives - TechRepublic
阮一峰的网络日志
阮一峰的网络日志
N
News and Events Feed by Topic
GbyAI
GbyAI
B
Blog
O
OpenAI News
博客园_首页
Cisco Talos Blog
Cisco Talos Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hacker News: Ask HN
Hacker News: Ask HN
TaoSecurity Blog
TaoSecurity Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
M
MIT News - Artificial intelligence
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
Webroot Blog
Webroot Blog
Simon Willison's Weblog
Simon Willison's Weblog
Y
Y Combinator Blog
C
Cisco Blogs
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
AI
AI
W
WeLiveSecurity
aimingoo的专栏
aimingoo的专栏
The Register - Security
The Register - Security
Project Zero
Project Zero
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale

博客园 - ★金★

导出EXCEL table变宽格式 IE11兼容性设定 C#获取多个相同name值 DIV左右行 SQL中多项合并时请加ISNULL Repeater中绑定下拉菜单的2种方法 WebForm设置URL路由后要照顾好之前的连接 Repeater中获取HTML select 值 NPOI生成Excel 博文阅读密码验证 - 博客园 Firefox中不支持parentElement用parentNode取代 jquery给span赋值的时候出现firefox不兼容 jquery表单验证增加确认及可选不需要验证的方法 javascript可用数组取代case格式化字符 display和visibility的区别 SQL中Replace替换引号 javascript动态添加删除行后行内计算及取值 取代RadioButtonList及RadioButton方法
Jquery绑定Select下拉菜单
★金★ · 2011-07-05 · via 博客园 - ★金★

需要返回JSon数据集。
ASPX:
$.ajax({
type: "POST",
contentType: "application/json;utf-8",
data: "{strclassid:'" + strclassid + "'}",
url: "/AutoService.asmx/Show",
success: function (msg) {
var myObject = eval('(' + msg.d + ')');
for (var i = 0; i < myObject.length; i++) {
    $("#selectabc").append(("<option value='" + myObject[i].Id + "'>" + myObject[i].Names + "</option>"));
    }

Cs文件中可用

JavaScriptSerializer js = new JavaScriptSerializer();
return js.Serialize(USERS)

序列化
直接生成JSON文件更方便:

       StringBuilder sbGoodsName = new StringBuilder();
       sbGoodsName.Append("[{\"GoodsName\":\"请选择\",\"GoodsID\":\"-1\"}");
       DbDataReader dr = db.ExecuteReader(cmd);
       while (dr.Read())
        {
            sbGoodsName.Append(",{");
            sbGoodsName.Append("\"GoodsName\":" + "\"" + dr["names"].ToString() + "\",");
            sbGoodsName.Append("\"GoodsID\":" + "\"" + dr["id"].ToString() + "\"");
            sbGoodsName.Append("}");
        }
        dr.Close();
        sbGoodsName.Append("]");
        return sbGoodsName.ToString();