hy all,

i am attaching my project in which there is GetdatafromAPI is page.i want to implement pagination there,can anybody see and fix the error and share with me.

thank you in advance.


Hello Rohan

There is no way to make pagination when you are using an API method to fetch data that does not implement pagination on itself.

The idea of "pagination" is to show only a certain number of records, and when the user changes page, to fetch, from the source, the next batch of records. This is used more to improve performance than anything else. 

In your case, your API method is bringing "everything". You are just not showing everything. 

If you want to implement pagination in your List, you will have to "keep" all the records in the Viewstate, because you will need to have access to the entire list you fetched initially. As the Viewstate is sent to the server on every request, and sent back on every response, depending on the number of records and users in the same page, your application will become really slow, if not become unresponsive at all.

A possible way to deal with this situation would be to make some type of "cache" of the API data in a server entity, and fetch data from the server entity instead, as then you could use the normal approach for pagination (that in traditional applications are bad anyway).