将数组从客户端传递到服务端C# [英] Pass array from client side to service side C#
本文介绍了将数组从客户端传递到服务端C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I am calling a javascript function on button click using onclientclick with below function.
arrValue array will have all the required values and how can I move this array values to server side for further process.
我尝试过:
What I have tried:
function addValues() {
debugger;
var arrValue = [];
var hdnValue = document.getElementById("hdn").value;
var strValue = hdnValue.split(',');
for (var i = 0; i < strValue.length; i++) {
var ddlValue = document.getElementById(strValue[i]).value;
arrValue.push(ddlValue);
}
}
推荐答案
谷歌是你的朋友:好好经常拜访他。他可以比在这里发布问题更快地回答问题...
一次非常快速的搜索给出了近50万次点击:将数组从javascript传递到服务器端c# - Google搜索 [ ^ ]
In未来,请尝试自己做至少基础研究,不要浪费你的时间或我们的时间。
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...
A very quick search gave nearly half a million hits: Pass array from javascript to server side c# - Google Search[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
你可以使用Ajax。
You can use Ajax.
.ajax({
type:POST,
data:{arrValue:arrValue},
url :index.aspx,
suc cess:function(msg){
}
});
.ajax({ type: "POST", data: {arrValue :arrValue }, url: "index.aspx", success: function(msg){ } });
或者使用如下
[ ^ ]
如果解决方案的解决方案有效,请立即投票
Or use like below
[^]
please up vote if the solution works out of 5
这篇关于将数组从客户端传递到服务端C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文