Reputation: 71288
I have a js function
function(id){
// do a postback here and get the id on the server side
}
I need to send the id to the server, how could I do this?
any way will do, using additional/hidden controls anything
Upvotes: 0
Views: 621
Reputation: 460288
function(id){
__doPostBack('', id);
}
On serverside you can access the argument via forms/params collection and the key __EVENTARGUMENT
that is an autmatically generated HiddenField:
VB.Net:
Dim ID as String = Request("__EVENTARGUMENT")
or C#:
string ID = Request["__EVENTARGUMENT"];
Understanding the JavaScript __doPostBack Function
Upvotes: 2