Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 04, 2012 08:26 PM by march11
Contributor
3110 Points
1394 Posts
Dec 04, 2012 03:57 PM|LINK
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 register the script....
' arrylist
For p= 0 To arryLst.Count- 1
Page.ClientScript.RegisterArrayDeclaration("routeCoords", arryLst(p))
Next
Dim strScriptAs 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))
JAVA code:
// Createand ElementObject 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.
Participant
1687 Points
471 Posts
Dec 04, 2012 04:02 PM|LINK
routeCoords[n] - Where is n defined?
Dec 04, 2012 05:46 PM|LINK
In the code below....
Dec 04, 2012 06:15 PM|LINK
ok, sorry I missed that.
What about this section, is it not overriding the routeCoords each time?
For p=0 To arryLst.Count-1
Dec 04, 2012 08:26 PM|LINK
No, that loop populates the array and makes it available to javascript on the page. I have the issue fixed and will post the solution soon.
march11
Contributor
3110 Points
1394 Posts
passing VB.net array to javascript using ClientScript class
Dec 04, 2012 03:57 PM|LINK
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 register the script....
' arrylist
For p= 0 To arryLst.Count- 1
Page.ClientScript.RegisterArrayDeclaration("routeCoords", arryLst(p))
Next
Dim strScriptAs 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:
// Createand ElementObject of type"option"
var opt= document.createElement("option");
which populates a dropdownlist box.
javedwahid
Participant
1687 Points
471 Posts
Re: passing VB.net array to javascript using ClientScript class
Dec 04, 2012 04:02 PM|LINK
routeCoords[n] - Where is n defined?
march11
Contributor
3110 Points
1394 Posts
Re: passing VB.net array to javascript using ClientScript class
Dec 04, 2012 05:46 PM|LINK
In the code below....
var n= 0;
javedwahid
Participant
1687 Points
471 Posts
Re: passing VB.net array to javascript using ClientScript class
Dec 04, 2012 06:15 PM|LINK
ok, sorry I missed that.
What about this section, is it not overriding the routeCoords each time?
For p=0 To arryLst.Count-1
Page.ClientScript.RegisterArrayDeclaration("routeCoords", arryLst(p))
Next
march11
Contributor
3110 Points
1394 Posts
Re: passing VB.net array to javascript using ClientScript class
Dec 04, 2012 08:26 PM|LINK
No, that loop populates the array and makes it available to javascript on the page. I have the issue fixed and will post the solution soon.