GridView not paging correctly

R

Ronald S. Cook

I have an ASP.NET GridView that gets its data from an object (i.e. filling a
datatable, no datasourceid). I have the PageIndexChanging event captured
and have the following code in it:

gdvProduct.PageIndex = e.NewPageIndex;

gdvProduct.DataBind();


But I'm getting a blank page when I go to the next page.

Any ideas?

Thanks,
Ron
 
C

Cowboy \(Gregory A. Beamer\)

You are not rebinding the data.

The norm is this

In Page Load routine, in not is postback section
--------

1. Bind grid
2. Save dataset

In DataGrid index change routine
-------

Change page and bind

I have samples (albeit 1.0) on the Wiley extras site
(http://www.wiley.com/extras). Look for the book ADO.NET and XML: ASP.NET on
the Edge and download chapter 16 (VS version is Visual Studio,; SDK version
is SDK with batch files that act like make scripts). It is VB.NET, so you
will have to translate if you are using C# or J#.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top