473,388 Members | 1,391 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,388 software developers and data experts.

Datagrid paging more than 20 pages

I am using the datagrid. I have allowpaging=true. 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 pageindexChanged event, if
I explicitly set the .CurrentPageindex to a value it works fine. Am I
missing a step here? Please help.

Kalvin

/* BEGIN CODE */
Private Sub uiReports_PageIndexChanged(ByVal source As Object, ByVal e
As System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
uiReports.PageIndexChanged
uiReports.CurrentPageIndex = e.NewPageIndex
uiReports.DataBind()

End Sub

*/

Nov 19 '05 #1
2 1163
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
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...
2
by: RelaxoRy | last post by:
sqlConnection1.Open(); myReader = sqlCommand1.ExecuteReader(); DataGrid1.DataSource = myReader; DataGrid1.DataBind(); myReader.Close(); sqlConnection1.Close(); The Datagrid populates fine. ...
3
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
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...
2
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...
2
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...
5
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...
4
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...
3
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.