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

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top