0
<script>
    var returnstring= "<%= CodeBehindFunction() %>";    
</script>

I need this

<script>
    var returnstring= "<%= CodeBehindFunction(parameter) %>";    
</script>

but error occurs that parameter does not exist in the current context.

Iwo Kucharski
  • 3,735
  • 3
  • 50
  • 66
Shum
  • 41
  • 8
  • 3
    You can't call a method on the server from javascript in that fashion (`CodeBehindFunction()` runs on the server while the page is loading - the client has no knowledge of it, and therefore can't supply parameters) - you need to do a full round trip using, for example, ajax. [See this question](http://stackoverflow.com/questions/886903/calling-an-asp-net-server-side-method-via-jquery) for a way to make it work. – James Thorpe May 04 '16 at 11:14

1 Answers1

-1

You're trying to make use of a page method. look following link for help.

http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx