Efficient paging GridView ... not quite working

I'm trying to wrap around user paging in an ASP.NET Gridview, but all the examples I read seem bloated with things that I don't need ( Scott Gu , for example).

Can someone point me in the right direction a tutorial that is easy to understand the basics?

EXAMPLE: If I have the following stored procedure ...

Alter Procedure dbo.GetReqeusts

@Category nvarchar(50)

As
Begin
  Select dbo.[Name], 
         dbo.[ID] 
  From   dbo.[Table] 
  Where  dbo.[Category] = @Category
End

And this example returns 200 rows, how would I convert this stored procedure into an efficient swap procedure?

0
source share
1 answer

4guysfromrolla.com . .

ROW_NUMBER() :

SELECT RowNum, [Name], [ID]
FROM
   (SELECT [Name], [ID]
         ROW_NUMBER() OVER(ORDER BY [ID]) as RowNum
    FROM [Table] t
    WHERE [Category] = @Category
   ) as DerivedTableName
WHERE RowNum BETWEEN @startRowIndex AND (@startRowIndex + @maximumRows) - 1
+2

All Articles