.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 >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Pagination In DataList

Posted By:Amitesh Kaushik       Posted Date: October 10, 2010    Points: 5    Category: SharePoint    URL: http://www.dotnetspark.com  

DataList is a type of control which does not have in built in paging facilities as in case of GridView the following code can help you out for pagination in DataList
 

private void BindForPaging()

{

    pds.DataSource = ds.Tables[0].DefaultView;

    pds.AllowPaging = true;

    pds.PageSize = 3;

    pds.CurrentPageIndex = currentPage;

    ViewState["PageCount"] = pds.PageCount;

    DataList1.DataSource = pds;

    DataList1.DataBind();

}

ButtonNext_Click()

{

   currentPage=currentPage+1;

   BindForPaging();

}

ButtonPrev_Click()

{

   currentPage=currentPage-1;

   BindForPaging();

}


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

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