Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a list object in Cs page with 2Row.
How to get it separately in Aspx page
Eg: For a single value It will be:

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


How to get a list separately ,like the above code.
Posted
Comments
SRS(The Coder) 19-Jun-14 0:06am    
Those two values you want to view in different controls or anything else you want to do ?

You can use '$.each' of jQuery to iterate through all the rows fetched from database.

Ex:
$.each($.parseJson(data.d), function(i, obj){
// i is index
// obj is object
});

1 solution

Try like this :

Example 1: (Populate data from array list)
JavaScript
var myList = "101/102/103/104/105".split('/');
$.each(myList, function (i, o) {
    //o is Object; (ex. 101,102 etc)
    //i is index; (staring from zero)
});



Example 2: (Populate data from array list)
JavaScript
var myList = [101, 102, 103, 104, 105];
$.each(myList, function (i, o) {
    //o is Object; (ex. 101,102 etc)
    //i is index; (staring from zero)
});


Example 3: (Data retrieve from database)
JavaScript
//id : Columnn 1
//name : Columnn 2
//address : Columnn 3
var myData = [{ id: 101, name: "name1", address: "Pune" }, { id: 102, name: "name2", address: "Mumbai"}];
//myData.length is 2 (i.e 2 Rows)
$.each(myData, function (i, o) {
    //o.id (id of the running row)
    //o.name (id of the running row)
    //o.address (id of the running row)
});
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900