I am trying to use the ASP.net class ClientScript to pass an array to my aspx page. I have succesfully completed an earlier sample to do this (code sample below). But a new routine is not working. The difference is the ClientScript class.
Error states that "routeCoords is undefined"
my java code is...
function newTest() {
var myArray = [ , ];
var n = 0;
var recCount = routeCoords.length / 15;
for (var i = 0; i < recCount ; i++) {
for (var s = 0; s < 15; s++) {
myArray[i, s] = routeCoords[n];
n++;
alert(myArray[s], [i]);
}
}
}
vb.net to build array and register the script....
' arrylist
For p = 0 To arryLst.Count - 1
Page.ClientScript.RegisterArrayDeclaration("routeCoords", arryLst(p))
Next
Dim strScript As String = "newTest();"
ClientScript.RegisterStartupScript(GetType(Page), "newTest", strScript.ToString, True)
the array is correctly populating in vb.net
this is the routine from the sample that is working...
VB.net code:
For s = 0 To arryLst.Count - 1
Page.ClientScript.RegisterArrayDeclaration("parmTypeAry", arryLst(s))
Next
JAVA code:
// Create and Element Object of type "option"
var opt = document.createElement("option");
//Add the option element to the select item
listID.options.add(opt);
//Reading Element From Array
opt.text = parmTypeAry[s];
which populates a dropdownlist box.