473,320 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Datagrid PageIndexChanged event handling

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
Nov 19 '05 #1
2 1412
Check your page load code.
You should only bind the data to the grid during initial page load not
during IsPostback.
--
Joe Fallon

"Gopalan" <go***************@btinternet.com> wrote in message
news:ea**************@TK2MSFTNGP10.phx.gbl...
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

Nov 19 '05 #2
Ya, check the IsPostBack in the Page_Load(), and you forget to rebind the
datagrid after in the PageIndexChanged event there.

Good luck !
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alex | last post by:
I created a page to show RealEstate Data with images retrived from the MSSQL 2000. I am using a DataGrid control: <asp:datagrid AllowPaging="True" OnPageIndexChanged="Pageindexchanged" > ...
3
by: Ruy Castelli | last post by:
Hello, I'm trying to get the details out of a datagrid component and it works fine when I'm accessing the first page of the datagrid, but when I try to click on the details hyperlink for an item...
3
by: Rick Strahl [MVP] | last post by:
Hi all, I'm loosing my mind <g>... I have a datagrid and I can't for hte live of me not get the PageIndexChanged event to fire in my codebehind form. <asp:datagrid id="dgErrorLog"...
2
by: enak | last post by:
I can not get my datagrid to page. I have a datagrid that I can sort 2 of the columns. This works great. I added paging and when I display the dg it shows 5 pages. (I am showing page numbers at...
1
by: Jeremy | last post by:
I want my gird to sort only the items on the current page when I click on a column header. I wrote a little test app, but when I sort it pulls in items from other pages and places them on the current...
1
by: RJN | last post by:
Hi Sorry for posting again. I have a datagrid which is put inside a div tag to make it scrollable. I need to page the datagrid. The page numbers appear at the bottom of the datagrid and has...
2
by: RJN | last post by:
Hi Sorry for posting again. I have a datagrid which is put inside a div tag to make it scrollable. I need to page the datagrid. The page numbers appear at the bottom of the datagrid and has...
6
by: Dee | last post by:
Hi The paging numbers of my DataGrid dont actually page. What can be the cause? Everyting else seems to work. Thanks Dee
3
by: Danky | last post by:
Hello Masters! Anyone can help me with the datagrid, well, the app load a lot of data from DB and it show on the datagrid, and well, I need to allow paging and.... the issue is with the event...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.