[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Dataset Paging without using a DataGrid

Posted on 2012-09-13
6
Medium Priority
?
297 Views
Last Modified: 2012-09-17
Hi All,

Can someone help with the above, im new to DataSet's and need some code so I can page 10 results at a time.
0
Comment
Question by:marc_butler
  • 2
  • 2
  • 2
6 Comments
 
LVL 20

Expert Comment

by:informaniac
ID: 38395839
Can you please elaborate what you are trying to achieve. Paging a dataset doesn't seem a required thing unless you are displaying it somewhere
0
 
LVL 18

Expert Comment

by:Rajar Ahmed
ID: 38395917
May i know the reason why you are paging using dataset and avoiding datasource control ie datagrid paging ?

Since , dataset paging is more or less going to work as same as datagrid paging as every time you will be getting the next 10 records from the memory ie dataset .

If your aim is for memory optimization / performance tuning then you should build a store procedure which can return 10 records according to the page index which deals with a few amount of work to be done but at the end you will find a better result .

The above store procedure approach is done below :
http://www.codeproject.com/Articles/16238/GridView-Custom-Paging

Hope it helps :
Meeran03
0
 

Author Comment

by:marc_butler
ID: 38396122
Hi All,

I am very new to ASP.NET, this is my first website I’ve designed in it.

I am open to any suggestions you may have. I could use a GridView/FormView, but my graphics designer has made the webpage in such a way. That it would be getting on close to impossible to do in a GridView and the powers that be will not let me waver from his design.

I think I might of found a way around the problem by using a ROW_NUMBER() function in TSQL and dynamically changing the SELECT string in the DataSet based on the page number required.

Would this be an appropriate way to do it?

Marc
WITH DATAROWS AS
(
	SELECT ROW_NUMBER() OVER (ORDER BY dbo.CLAIM.Ref DESC) AS RowNumber, dbo.CLAIM.*
	FROM dbo.CLAIM
	WHERE (dbo.CLAIM.SOURCE_ID = 223)
)
SELECT DATAROWS.*
FROM DATAROWS
WHERE ((DATAROWS.RowNumber BETWEEN 1 AND 10));

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 2000 total points
ID: 38396224
That it would be getting on close to impossible to do in a GridView 

Open in new window

No mate, gridview are not alien towards design they work elegantly when you use appropriate style and class . It has so many many properties for style setting even for every bit of column .  

Have this in mind : "Gridview Are just a html table when render to the browser " So if you can apply any class/style to table then the same thing can be applied to gridview.

i hope below follows your approach[Storeprocedure Approach]
http://www.codeproject.com/Articles/125541/Effective-Paging-with-GridView-Control-in-ASP-NET?fid=1595537&fr=26

Meeran03
0
 
LVL 20

Expert Comment

by:informaniac
ID: 38396272
Thats a very good link Meeran03. Thanks.. :)
0
 

Author Comment

by:marc_butler
ID: 38396615
Hi All,

Thanks for your advise, I have no problem with the CSS. But as I've never writen a ASP GridView nor a Stored Procedure in SQL before. Can I leave this question open and ask you some questions as im in the process of writing it?

Marc
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question