jennifercheng2008
Programmer
I have a string array SchoolName[100] in .net aspx.cs file. Now I want to pass this array to javascript code. But I can't use following code:
var addresses=new Array();
for (var i=0; i <99; i++)
{
addresses= "<%=SchoolName %>";
}
If i is not defined in aspx.cs file, the error will show i is not defined there.
But if i is defined in aspx.cs file, any addresses will be assigned to the value of SchoolName[0].
I can assign values as following:
addresses[0]= "<%=SchoolName[0] %>";
addresses[1]= "<%=SchoolName[1] %>";
.
.
.
addresses[99]= "<%=SchoolName[99] %>";
But it is not good since SchoolName size should always change.
I would be appreciated if you may give me some advice.
Jennifer
var addresses=new Array();
for (var i=0; i <99; i++)
{
addresses= "<%=SchoolName %>";
}
If i is not defined in aspx.cs file, the error will show i is not defined there.
But if i is defined in aspx.cs file, any addresses will be assigned to the value of SchoolName[0].
I can assign values as following:
addresses[0]= "<%=SchoolName[0] %>";
addresses[1]= "<%=SchoolName[1] %>";
.
.
.
addresses[99]= "<%=SchoolName[99] %>";
But it is not good since SchoolName size should always change.
I would be appreciated if you may give me some advice.
Jennifer