the RegisterArrayDeclaration is rather stupid and useless. it takes two
parameters, the array name and a string which is the actual javascript
array initialization code. for an int array it wants:
Page.ClientScript.RegisterArrayDeclaration("myArra y","1,2,3");
so you need a helper routine for an int array (air code):
public string JScriptArrayDeclaration(int[] a)
{
string s = "";
string sep = "";
for (int i=0; i < a.Length; ++i)
{
s += sep + a[i].ToString();
sep = ",";
}
return s;
}
-- bruce (sqlwork.com)
C wrote:
Hi,
I have a 3 dimenionsal array which I populate in my C# code.
I then want to make this available to my Javascript so I do below.
Page.ClientScript.RegisterArrayDeclaration("myArra y", myArray.ToString())
When I view my source html I see var myArray = new Array(System.Int32[,])
What am I doing wrong here?