Click here to Skip to main content
15,917,174 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display 8 records on a page in DataList control but in my logic i assign no. of records to it How to display that only 8 records?

Example:-
In code behind:
C#
DataList1.Datasource=obj.GetData();

Here GetData() provide no. of records but i want to show only 8 on my page.
Posted
Updated 19-Oct-12 6:15am
v3
Comments
Sandeep Mewara 19-Oct-12 10:32am    
Please elaborate.

Unless I am misunderstanding you, it sounds like you are trying to use paging. To do this you will need to use either a GridView control or a ListView control plus an imbedded DataPager control.

If you simply want to limit the data sent to your DataList control, then in the code behind do something like this:
C#
myDataList.Items = myList.Take(8);
myDataList.DataBind();
 
Share this answer
 
please elaborate on your question
 
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