Question : how to let javascript load data from a server

Hello,

I need to write a JavaScript program (running on the client side).
It shall load data from a server and show something. Unfortunately frame and iframe are not allowed (eBay).
I have no clue how to get in touch with the server.
Any tips?

Thank you so much.

Christine

Answer : how to let javascript load data from a server


ktmedlin, I had to appreciate the shortcut you tried (adding a list of list and trying to get inner list in columns and the outer list in rows); I am not sure if there is any special way in datagridview for that, but below is the standard way....

When you set the List to datagrid view's datasource, it takes the object in the list and tries to show the properties of the object in columns. in your case the object is another list; so it shows the members of List object which are Capacity and Count.

You need a code something like below. with this code you need to know the maximum columns (tab separated in the csv file). Below code works for max three tab separated values...

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:


List<CSVLine> list = new List<CSVLine>();
TextReader reader = new StreamReader(@"C:\MyFile.csv");
while (reader.Peek() > -1)
     list.Add(new CSVLine(reader.ReadLine());
reader.Close();
grid.DataSource = list;
grid.DataBind();


public class CSVLine   // use a better name if you want..
        {
            private string _v1;
            private string _v2;
            private string _v3;

// if there are more columns in the csv tab separated line, then you need to more ValueX members (like Value4, Value5)
// actually instead of using Value1, etc, you can use the actual business name like (Name, Age, etc)

            public string Value1
            {
                get { return _v1; }
                set { _v1 = value; }
            }

            public string Value2
            {
                get { return _v2; }
                set { _v2 = value; }
            }

            public string Value3
            {
                get { return _v3; }
                set { _v3 = value; }
            }

            public CSVLine(string csvLine)
            {
                string[] vals = csvLine.Split('\t');

                Value1 = vals[0];
                Value2 = vals[1];
                Value3 = vals[2];
            }
        }
Random Solutions  
 
programming4us programming4us