3
votes

I'm trying to bind a datatable to a detailsview, however not all records that are in the datatable are being displayed in the detailsview.

For example, my datatable will have 2 distinct rows. When bound to the detailsview, it allows me to page between 2 pages, however the details on each page are identical and do not show the individual results that are in the datatable.

I am binding as such:

            DetailsView1.DataSource = dt;
            DetailsView1.DataBind();

I'm not sure if this matters, but when the details view is first bound it is done so using DataSourceID to the SQLDataSource.

EDIT: I am handling the pageindexchanging event.

Thanks.3

2

2 Answers

0
votes

You have to implement the Paging event.

0
votes

may need to call DataBind() in your paging event after page is changed:

DetailsView1.PageIndex = e.NewPageIndex; 
DetailsView1.DataBind();