This topic is locked
[SOLVED]

 button passing arrays btwn server tab and client after tab using result[]

11/15/2018 7:27:14 AM
ASPRunner.NET General questions
H
heilmanmd author

How do you pass an array [] when using a button from the server tab to client after tab using the result[]
Example:
Server Tab

---------------
string [] names = new string[25];
names[0] = "John";

names[1] = "Mark";

names[2] = "Frederick";
result["names"] = names; <<<<<< get run time ERROR cannot implicitly convert type 'string[]' to runnerDotNEt.XVar
Client After tab

----------------------
var names = result["names"];

alert('names[0]= " + names[0]);
Any feedback / thoughts appreciated.
Best

Mark

Big Timber, MT - USA

admin 11/15/2018

Try something like this:
dynamic names = XVar.Array();

names.InitAndSetArrayItem("John",1);

names.InitAndSetArrayItem("Mark",2);

names.InitAndSetArrayItem("Frederick",3);

result["names"] = names;

H
heilmanmd author 12/14/2018

This is a little after the fact, but what I ended up doing was a bit of a work around, but a cool one...
On the server side I built a string with a field delimiter ( in my case I used the | char )
then on the after server side I used javascript split function to process the array...
the array having names etc...
and fast...
worked...
Best

Mark