473,624 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid paging more than 20 pages

I am using the datagrid. I have allowpaging=tru e. I load the data and
there is about 7000 records. At the bottom there is pages 1 through 10
and (...). The first time I click on (...) it takes me to pages 11
through 20. If I choose 12 it takes me to page 2. If I choose (...)
it goes to pages 1 through 10 again. In the pageindexChange d event, if
I explicitly set the .CurrentPageind ex to a value it works fine. Am I
missing a step here? Please help.

Kalvin

/* BEGIN CODE */
Private Sub uiReports_PageI ndexChanged(ByV al source As Object, ByVal e
As System.Web.UI.W ebControls.Data GridPageChanged EventArgs) Handles
uiReports.PageI ndexChanged
uiReports.Curre ntPageIndex = e.NewPageIndex
uiReports.DataB ind()

End Sub

*/

Nov 19 '05 #1
2 1169
Found a fix. Would love an explanation so I will understand.

If I set the EnableViewState on the grid to false, it will not page
correctly.
If I set it to True, it will page just like it should.

Is this by design, or by accident?

Kalvin

Nov 19 '05 #2
Kalvin,

Much of the functionality of the datagrid depends on having the
viewstate enabled. For example, a number of events will no longer fire
when you disable the viewstate. Unfortunately, keeping the viewstate
enabled tends to significantly bloat your page. Take a look at the the
HTML after your page is rendered (make sure you turn on text /word
wrapping) and you will probably notice that half of the html in your
page is dedicated to the viewstate, and probably almost all of it for
your datagrid.

An alternative is to create your own paging mechanism with code so that
you can turn off the viewstate on the datagrid. Try the link below for
a start.

http://www.mastercsharp.com/article....=76&&TopicID=2

I have a user control that I made using a repeater that has the
sorting, paging, and other functionality bundled into it. Viewstate is
turned off. In this way, I don't need to rely on the datagrid to get
that functionality.

Bill E.

Nov 19 '05 #3

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

Similar topics

0
1613
by: Stephen | last post by:
This is a real brain-teaser and i'd really appreciate it if someone can try and understand what im trying to do and give me a few pointers or ideas to help me work out my problem. Im basically using the example of CUSTOM PAGING on a DataGrid on this page: http://www.dotnetjunkies.com/Tutorial/EA868776-D71E-448A-BC23-B64B871F967F.dcik and im trying to add extra functionality in the DataGrid Paging - Custom Paging example. I'm able to get...
2
3567
by: RelaxoRy | last post by:
sqlConnection1.Open(); myReader = sqlCommand1.ExecuteReader(); DataGrid1.DataSource = myReader; DataGrid1.DataBind(); myReader.Close(); sqlConnection1.Close(); The Datagrid populates fine. I'm styling it on the HTML page. I configure the DataGrid for paging through the property builder fine. I AllowCustomePaging=true;. The page loads fine but it only shows "1"
3
8676
by: Joseph D. DeJohn | last post by:
I am trying to get pagination working on a datagrid. Can anyone point me to a resource for help on this? I'm not sure if custom paging is the best option or not.
2
2243
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 the bottom of the dg.) When I click on the pages nothing happens until I get to the last page. Then and only then is the last page displayed. If I go back through the pages the second to last page displayes the first page again.
2
1748
by: Daniel Walzenbach | last post by:
Hi, I have a question regarding the DataGrid control. If paging is enabled the grid binds the data, sets the paging on the top/bottom (or however it is set up) and throws away unnecessary data. So far so good for a tiny amount of data but if some 100000 of rows are the source this approach is stupid.
2
1854
by: Axel Dahmen | last post by:
Hi, I'm using a DataGrid control to show a table's content with paging. For navigation through the pages I'm using the DataGrid's intrinsic navigation section. My problem: The DataGrid navigation links use JavaScript to jump between pages. I want them to use standard hyperlinks providing the page number in some URL parameter so that I can copy the hyperlink elsewhere.
5
2771
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
4
6265
by: karunakar rao | last post by:
Hi All I need some help. I have been populated 50,000 Records in asp.net C# datagrid. Ever page has 10 records Example "<< Prev 1 2 3 4 5 6 7 8 9 10 Next>> Iam showing like that in my datagrid When ever click the Next Buttuon Iam getting data from database Total(50,000) Records.Every time performanse wise it is taken lot of
3
3142
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method expects a DataGridColumn so I instantiated an object of type TemplateColumn that I had hoped I could add a CheckBox to. I soon discovered that the ItemTemplate property of the TemplateColumn class returned an object that had implemented the...
0
8175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.