Click here to Skip to main content
14,735,283 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have some javascript function like this-
function updateVaues(paramValues)
  document.getElemntById('<%= txtRequisitionNo.ClientID %>').value=paramValues[0];
 //to fill gridviewItem I am calling c# method from javascript as--
  <% fillGrid(paramValues[0]); %>


But I am getting error that paramValues does not exist

Then how can I pass paramValues[0] to fillGrid() in c#
Updated 15-Feb-14 7:43am

You cannot do it. Just think about it: Javascript is executed on client side, and C# code is one the server side. Whatever happens between client and server side could be anything but not "call". The server-side code only works in response to some HTTP request from the client side. In particular, you can use Ajax to send a request. Please see:[^].

One convenient way to send an HTTP request using Ajax is using jQuery .ajax():[^].

neelamblue 15-Feb-14 12:55pm
function called within-[^]
are of javascript But I need to pass javascript variable to C# method

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900