This is a migrated thread and some comments may be shown as answers.

Is RadListView got all the items in the Datasource?

4 Answers 132 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Phuc
Top achievements
Rank 1
Phuc asked on 21 Sep 2012, 10:58 AM
Hello, I wanna ask you a question about paging in RadListView. I saw this demo http://demos.telerik.com/aspnet-ajax/listview/examples/paging/custompaging/defaultcs.aspx and wonder if the radlistview query all the items first then do paging, or just get 10 items after each click?

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Sep 2012, 12:27 PM
Hi,

When custom paging is enabled, RadListView fires its server-side PageIndexChanged event and automatically rebinds after that. You can retrieve the requested page of data for RadListView.In this demo page index is set  as the SelectParameter in SqlDatasource and then corresponding data is fetched in the PageIndexChanged event of RadListview.

Hope this helps.

Thanks,
Princy.
0
Phuc
Top achievements
Rank 1
answered on 24 Sep 2012, 02:26 AM
Thanks for your respond. I'm a new with telerik, can you show me the simple ascx code file and code behind (C#) with all the events, and all the things needed, I just want to know how to apply custom paging in my project.

My context is : I have a SQL database with 10000 items. I have a function which get 10 items (as List<DataItem>) per invoking (with page index as parameter of this function). I just want to show 10 items in the UI and after clicking the page number, the server will call this function for getting other 10 items.

Thanks so much, please tell me if you need any information.
0
Accepted
Tsvetina
Telerik team
answered on 27 Sep 2012, 07:28 AM
Hello Phuc,

I am attaching a sample project to this message showing how you can perform custom paging when binding RadListView programmatically. You just need to handle NeedDataSource, and set:
1) The VirtualItemCount property of the control, which should give the total number of items in the listview datasource.
2) The DataSource property of RadListView. It should contain only the items for the current page. To get them you can use the CurrentPageIndex and PageSize values provided by RadListView.

Kind regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Phuc
Top achievements
Rank 1
answered on 27 Sep 2012, 10:27 AM
Really thank you to you all, I love your kind of response :)
Tags
ListView
Asked by
Phuc
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Phuc
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or