我有一个js函数
function(id){
// do a postback here and get the id on the server side
}
我需要将id发送到服务器,我该怎么做?
任何方式都可以,使用附加/隐藏控件任何东西
最佳答案
function(id){
__doPostBack('', id);
}
在服务器端,您可以通过 forms/params 集合和自动生成的 HiddenField 键 __EVENTARGUMENT
访问参数:
VB.Net:
Dim ID as String = Request("__EVENTARGUMENT")
或 C#:
string ID = Request["__EVENTARGUMENT"];
关于javascript - 如何进行回发并从该回发中的 html 中获取值(value),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4899407/