Datagrid PageIndexChanged event handling

G

Gopalan

Hi

I have got a Datagrid populated with a Dataset.

The first time the datagrid shows the first page data.

When I clicked the Next link to display the next page data it displays the
same data again.

I tested whether the event handling function is being called or not, it
seems it is not called when I click the Next button.

private void dgWebStatistics_PageIndexChanged(object sender,
DataGridPageChangedEventArgs e)

{

try

{

dgWebStatistics.SelectedIndex=-1;

dgWebStatistics.CurrentPageIndex = e.NewPageIndex;


}

catch(Exception Ex)

{

}

finally

{

}

}

Please help me in finding out the error in this.

Thanks

BG
 
J

Joe Fallon

Check your page load code.
You should only bind the data to the grid during initial page load not
during IsPostback.
 
G

Guest

Ya, check the IsPostBack in the Page_Load(), and you forget to rebind the
datagrid after in the PageIndexChanged event there.

Good luck !
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top