How to print a list of values ​​from a Cs page to a presentation level (Aspx)

I have a list object on a Cs page with 2Row.
How to get it separately on an Aspx page
For example: For one value it will be:

$("#txtBilldate").val(data.d.lphBillDate);

How to get a list like the code above.

+4
source share
1 answer

Send it to the ASPX As array using LINQ and access it.

       return list       
              .Select(a => new
              {
                  a.column1,
                  a.column2,
                  a.column3
              }).ToArray();

Access it using JS

 var models = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;

for (var i = 0; i < models.length; i++) {
      $("#txtBilldate").val(models[i].column1);
    }
0
source

Source: https://habr.com/ru/post/1545061/


All Articles