Datagrid PageIndexChanged event handling

  • Thread starter Thread starter Gopalan
  • Start date Start date
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
 
Check your page load code.
You should only bind the data to the grid during initial page load not
during IsPostback.
 
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

Back
Top