?
Solved

Datalist paging

Posted on 2011-02-27
3
Medium Priority
?
509 Views
Last Modified: 2012-06-27
How can I enable paging in datalist control in asp.net 4.0? please give me a c# sample.

thanks

ayha
0
Comment
Question by:ayha1999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 400 total points
ID: 34991852
0
 
LVL 13

Accepted Solution

by:
Rahul Agarwal earned 600 total points
ID: 34994192
0
 
LVL 19

Expert Comment

by:Manoj Patil
ID: 34994921
Hi,

First you can write region like this
#region PagedDataSource
    PagedDataSource _PageDataSource = new PagedDataSource();
    #endregion

Open in new window

You just put the Following Code in BindItemsList()

 _PageDataSource.DataSource = DSnew.Tables[0].DefaultView;
            _PageDataSource.AllowPaging = true;
           [b] _PageDataSource.PageSize = 12;[/b]  // Define Page Size what you want.
            _PageDataSource.CurrentPageIndex = CurrentPage;
            ViewState["TotalPages"] = _PageDataSource.PageCount;
 this.lblPageInfo.Text = "Page " + (CurrentPage + 1) + " of " + _PageDataSource.PageCount;
            this.lbtnPrevious.Enabled = !_PageDataSource.IsFirstPage;
            this.lbtnNext.Enabled = !_PageDataSource.IsLastPage;
            this.lbtnFirst.Enabled = !_PageDataSource.IsFirstPage;
            this.lbtnLast.Enabled = !_PageDataSource.IsLastPage;

            this.dListItems.DataSource = _PageDataSource;
            this.dListItems.DataBind();
            this.doPaging();

Open in new window

0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 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