.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

Pagination in c#

Posted By: kamlesh     Posted Date: February 11, 2011    Points:2   Category :Windows Application
hi..

i want pagination in my application when i import something from drive it should give me that records in paging format because i am waiting for until my all data will import so i need pagination in my application so if any body have nay idea ofr source code then please help me

thanks
kamlesh nikam

Responses
Author: Blessy Baby             
Posted Date: February 11, 2011     Points: 5   

Hi,

You can use Linq Skip and take operator for pagination.

vary query= from tbl from DataContext.GetTable<tableName>()
select tbl;
return query.Skip(startRowIndex).Take(maximumRows);


Blessy Baby
Project Lead
Digitalmesh Softech India (p) Limited
Cochin,Kerala
Author: kamlesh             
Posted Date: February 24, 2011     Points: 5   

Thanks Blessy

but i cant understand wt u r saying please give me some examples suppose
i take 1000 files and i am storing it in database and i want to show that data on datagridview in
first 100 files then after sometime 100 files because for showing all 1000 files it take much time.
so how to do ? in c#

Thanks
Kamlesh


Thanks And Regards.
Kamlesh Nikam
Author: Balwant             
Posted Date: February 25, 2011     Points: 5   

hi
u can create page in window datagridview by using store procedure at the back end.
here is the code of the store procedure which only show 100 rows at a time in window form and next 100
after u click on button u have created to navigate grid.
u can send pagenum as parameter
from the C# coding.

DECLARE @PageNum AS INT;
DECLARE @PageSize AS INT;
SET @PageNum = 1;
SET @PageSize = 100;

WITH OrdersRN AS
(
SELECT ROW_NUMBER() OVER(ORDER BY OrderDate, OrderID) AS RowNum
,OrderID

,OrderDate
,CustomerID
,EmployeeID
FROM dbo.Orders
)

SELECT *
FROM OrdersRN
WHERE RowNum BETWEEN (@PageNum - 1) * @PageSize + 1
AND @PageNum * @PageSize

ORDER BY OrderDate
,OrderID;

i have create this store procedure is created by using sample table u can apply this to ur table


thanks & Cheers!
Balwant

Logic Lab technologies
Email:balwant.mnd@gmail.com
Website:www.techlogiclab.com
Author: kamlesh             
Posted Date: February 28, 2011     Points: 20   

Thanks Balwant..
but still that window will open uptill the all data will store in database

Thanks And Regards.
Kamlesh Nikam
Author: Balwant             
Posted Date: February 28, 2011     Points: 20   

hi,

u wants data store from page or retrieve data from db to page?
this store procedure is tested and works fine and show the data from db according to page size u
have provided by passing parameter to store procedure and page no. as another parameter.

1st of all understand it and then apply


thanks
balwant

Logic Lab technologies
Email:balwant.mnd@gmail.com
Website:www.techlogiclab.com
Author: kamlesh             
Posted Date: February 28, 2011     Points: 20   

i want to store and retrieve it on datagridview without wait for storing all data to
database because i have to wait for some time until all data get stored on database for
that i have used threading. and take one button for refresh button.
so if u have any idea then let me know..

th = new Thread(new ThreadStart(disp));
th.IsBackground = true;
th.Start();


void disp()
{
ClsParser.GetRoutFolderName();
Thread.Sleep(1000);
}

GetRoutFolderName it is a function where i wright all function to store all data on database

so is right please let me know
Thanks
Kamlesh

Thanks And Regards.
Kamlesh Nikam


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend