Click here to Skip to main content
15,908,843 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I show through an Example ....

<asp:Button id="" runat="server" onclientClick="JavaScript : PassVal(intArrayval);">

Jscript
-----

PassVal(arrrayval){
}
Posted

It's not solving the issue itself but it solves the problem if you have only one array to pass: you can send an arbitrary number of parameters to a JavaScript function, and access them through the arguments special variable. It becomes analogous to a function accepting a variable number of arguments, with the same advantages and problems (for instance, you have to pass the array last, and as mentioned earlier you can only pass one).

Here's an example JavaScript function:

C#
function foo()
{
    var stringArgs = [];
    for (var i = 0; i < arguments.length; i++)
        stringArgs.push(arguments[i]);

    // do stuff with stringArgs
}


And you'd call it from C# like this:

XML
List<string> arguments = new List<string>();
arguments.Add("foo");
arguments.Add("bar");
webBrowser.InvokeScript("foo", arguments.ToArray());


Thanks,
-RG
 
Share this answer
 
Comments
k07 5-Mar-14 3:44am    
Thank you for your support.
you can do onething here[ by using viewstates or any of the statemgt technique hold data and set it to hidden field]
now using that hidden field you can access data in javascript code
 
Share this answer
 

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