I personally prefer to do the paging in the stored procedure. Here is the general concept that I do in my paging queries:
Procedure GetJournals@groupID INT,@Begin INT,@End INTAS
--Create temp table as follows:CREATE TABLE #tmp( UID INT IDENTITY, JournalID INT)
INSERT INTO #tmp (JournalID)SELECT JournalID FROM Journals WHERE GroupID = @GroupID
SELECT Journals.* FROM Journals INNER JOIN #tmp ON #tmp.JournalID = Journals.JournalID WHERE #tmp.ID BETWEEN @Begin AND @End
Create an event for paging .Inside the event write the following code.
MyDataGrid.CurrentPageIndex=e.NewPageIndex; BindGrid();
BindGrid ()is a method which will populate date in datagrid from Database.
Then rightclick on datagrid go to property builder
Go to Paging
check the allow paging check box.
Set the property for number of records you want to dispaly. Sanat Kumar Mohapatra
Software Professional