Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gridview paging

Status
Not open for further replies.

KevoMee

Technical User
Apr 30, 2002
72
IE
I have a gridview with paging enabled. It shows 15 items at a time. In a search there could be 100s of items. Obviously I only want a particular 15 items returned from the database at a time. How can I enforce this?

The way I would do it with a datagrid would be get the required number myself and set up paging with virtualitemcount. This isn't possible with gridviews. I've read documentation and haven't been able to get a clear cut answer. Any info would be great. Thanks.
 
I am confused, what is your question? If you want 15 rows at a time, set the PageSize property. If you don't want to use the internal paging, you can use custom paging. Again, I am not really sure what you are looking for.

Jim
 
What you are suggesting is get all records from the DB and then setting it as a datasource for the grid. This could return 100s of records. This I don't want because if they only 15 viewable at a time I want to retrieve 15 at a time from the DB.

i have a wrapper that I put around my query to only return the same amount of records as my pagesize, which is 15. Which 15 is determined by the page index of the grid.

Now because I have only returned 15 I can't see any "next" link. How can I force this link to be there & have it cause a postback even though there is no 15 obviously available to the grid.

When using a datagrid this was easily to implement because all I had to do was set the virtualitemcount to be the count of all records returned (I would use select count (*) + sqlquery).

I know this is confusing but hopefully I've cleared it up a bit?
 
And here's another article on the same subject:


To answer your question though, you basically have an SP that returns the relevant results and you create the "previous" and "next" manually. Maybe not as easy as you are used to with the DataGrid but it probably provides more control...


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top