Click here to Skip to main content
15,898,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

my asp.net mvc webapi controller returning list of products by paging as json object.by using jquery am accessing that.
my requirement is i have to return count of that total products,because by paging am retriving few records only at a time.

Suggest me!!!

Thank u
Posted

return Json(new { Result = "OK", Records = students, TotalRecordCount = studentCount });

In view :

"recordsLoaded": function (event,data) {
$('#tab').html("Items ("+data.serverResponse.TotalRecordCount+")");
}
 
Share this answer
 
v2
I can only assume that the returned JSON is an array of objects. If so then you can get the size of the array in javascript with the 'length' property (instead of 'count', which doesn't exist in js)

See some good links

Link1
Link2
 
Share this answer
 

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