I'm trying to call a code behind method from JavaScript code. This works fine, but I am not sure how can I pass a JavaScript parameter to the method. If I put any value between the parenthesis, it is related as a CodeBehind context rather then script context. What is the solution to pass this parameter?
JavaScript:
var arg = this.id
<% setSelection(arg); %>
C#:
[WebMethod]
public void setSelection(string productID)
{
Session["selection"] = productID
}
I get this error of course: CS0103: The name 'arg' does not exist in the current context