ASP.netクラスClientScriptを使用して、配列をaspxページに渡そうとしています。これを行うための以前のサンプルを正常に完了しました(以下のコードサンプル)。しかし、新しいルーチンは機能していません。違いはClientScriptクラスです。
エラーは「routeCoordsが未定義です」と述べています
私のJavaコードは...
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を使用してアレイを構築し、スクリプトを登録します。
' 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)
アレイはvb.netに正しく入力されています
これは、動作しているサンプルのルーチンです...
VB.netコード:
For s = 0 To arryLst.Count - 1
Page.ClientScript.RegisterArrayDeclaration("parmTypeAry", arryLst(s))
Next
JAVAコード:
// 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];
ドロップダウンリストボックスに表示されます。