How can I page without using the datagrid?

J

John Morgan

In ADO used with classic asp I used to be able to page satisfactorily
using eg myObject.pageSize, myOb.PageCount type properties/methods.

All that I have read on paging in ASP.NET refers to the datagrid.
I would be grateful if someone could point me in the direction of how
I might page with ADO.NET and ASP.NET without using the datagrid.

All the information I wish to display is read only and I have a
reasonably complex html layout which I wish to use,

Best wishes to all, John Morgan
 
M

Miha Markic [MVP C#]

Hi John,

The best approach is to use database specific syntax, such as TOP x for
SqlServer and RowCount for Oracle.
Otherwise you might use less effective overload of Fill method that takes
first record and record count as parameters.
 
G

Guest

John

I just finished doing it. I have a combo control where I capture all the page starting keys that I need on each page. So like Record #s 1, 10, 20, 30 and so on.
--When I retrive actual data I say Select TOP 10 where Key > 1
--Populate the main query.
--Go and check if my table has more 30 +10 (where 30 is the last key in my combo) repopulate Combo, this time 40 is added
--Other wise combo is not repopulated.
--On next, I get Select TOP 10 where Key > 10
--In my table I never allow deletes. So all keys that I capture are always going to stay in there

HTH
Sachy
 
J

John Morgan

Sachy

I have not solved my problem to date so thanks for your help.

I follow you more or less but I am not sure what you mean by 'page
starting keys'. Is this a field within a tabel which you have put a
pecial consecutive series of numbers or is it any field which is
ordered and where you pick up the last value as a reference to the
start value of the next page?

As far as I can see if I am going to page using TOP 10 I have to have
an ordered series of unique values within a Field. I suppose this
could be the primary key but then the order might not be the order
that I require,

best wishes, John Morgan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top