Click here to Skip to main content
15,910,471 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I would like to create a friend list but at a time only 3 records can be display in GridView and when the user clicks on show all button then all records will be displayed (like friend list in Facebook and Orkut ).

Can any one help me out?

Thanks in advanced.
Posted
Updated 13-Nov-11 3:49am
v2

Use a query like this :
SQL
select top 3 * from friendslist
 
Share this answer
 
Comments
Naikniket 7-Nov-11 6:25am    
you have solved my prob.. thnx a lot..
thatraja 7-Nov-11 7:32am    
Simple way, 5!
But my solution in coding side.
Initially set paging to true and page size to 3
C#
(/YourGridViewObject/).AllowPaging=true;
(/YourGridViewObject/).PageSize=3;



On button click set allowpaging to false as

C#
(/YourGridViewObject/).AllowPaging=false;
 
Share this answer
 
Comments
Naikniket 13-Nov-11 10:26am    
i have solved dat with the help of 1st reply...
If you are using Linq then try this
Select rows from dataview using filter in the index[^]
or Dataadapter.Fill method.
 
Share this answer
 
Comments
Mehdi Gholam 7-Nov-11 8:00am    
5'ed
Naikniket 13-Nov-11 10:26am    
i have solved dat with the help of 1st reply...
First of all you need to do like this...

1) Only 3 Friend will display for this you need to use a query like Mehdi suggested

SQL
SELECT TOP 3 * FROM FRIENDLIST


or you can also put ORDER BY Cause at the end of your query.

OR MAKE your own query based on TOP number COLUMN NAME

it will returned only TOP 3 records from your friend list so you can use them to display for it....

2) When user click on Show All Friend Button at that time you need to fire you select Query with out use of TOP NUMBER COLUMN

so it will return all friend from your list, and use them to display for all friend...


like this you can use them...
 
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