Last post Jan 28, 2011 03:26 PM by nyelamarti
Jan 28, 2011 01:33 PM|nyelamarti|LINK
I want to do pagination in repeater control.
I am using repeater.Datasource = objectDataSource.
and objectdatasource is having generic list data.
When i try to cast objectdatasource to dataview ...i am getting exception saying "casting
Collections Generic List cannot be casted to Dataview".
Can anyone tell me easy way to do Repeater Pagination in the above mentioned case
Please show me the sample code if you have it.
Thanks in advance
Jan 28, 2011 02:00 PM|sansan|LINK
you can use a PagedDatasource to bind Repeater with paging enabled.
Instead of datatable, set PagedDataSource's Datasource to the list collection you are using
Jan 28, 2011 02:54 PM|nyelamarti|LINK
Thanks for your reply.
Actually my data is in ObjectDatasource.
I tried to this
pageddatasource pds = new pageddatasource();
pds.Datasource = (pageddatasource)objectdatasource.select();
still iam getting exception saying generic list cannot be casted to type pageddatasource.
i should be able to convert Icollections generic list to table or dataset or dataview.
is there a way i can do that.
if so please let me know
Thanks & Regards
Jan 28, 2011 03:03 PM|sansan|LINK
OK, keep your code as it is. If Converting List to datatable is the only issue, please get the code from
Add that extension method and just use yourlist.ToDataTable();. That's it
Jan 28, 2011 03:26 PM|nyelamarti|LINK
thanks santhosh for your reply.
I searched in google and found somthing like this
pds.DataSource = (IEnumerable<Items.Objects.Infoclass>) ObjectDatasource.Select();
Repeater.DataSource = pds;
<items.Objects.Infoclass> is class object...to which we have to convert.
once the data is in pds ...now its easy to do pagination.
and it worked for me.