473,698 Members | 2,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET:: Paging on Demand

Info::
Most of you must have worked on paging feature of DataGrid. its works fine as long as you have more no of records to show, but if you have configured 20 records per page and no of records you retrieved is less then 20 then also pager gets rendered at the bottom of the grid showing "1". most of us do not bother about it , but Clients ,,,uff...

Solution:
SQLDataAdapter. Fill(DS,"Emp")

If DS.Tables("Emp" ).Rows.Count > MyDataGrid1.Pag eSize then
MyDataGrid1.All owPaging = True
Else
MyDataGrid1.All owPaging = False
End if

MyDataGrid1.Dat aBind()

Any better ways?

ya perhaps this could have been reduced to one line also eg.

MyDataGrid1.All owPaging = ( DS.Tables("Emp" ).Rows.Count > MyDataGrid1.Pag eSize )

Anything better then this?

Regards
Jignesh Desai
www.dotnetjini.com

Jan 24 '06 #1
2 1387
Agreed, but you can also extend this paging template with a checkbox to disable it.
I did a similar thing but outside the grid.

"Jignesh Desai" <ji***********@ hotmail.com> schreef in bericht news:es******** ******@TK2MSFTN GP12.phx.gbl...
Info::
Most of you must have worked on paging feature of DataGrid. its works fine as long as you have more no of records to show, but if you have configured 20 records per page and no of records you retrieved is less then 20 then also pager gets rendered at the bottom of the grid showing "1". most of us do not bother about it , but Clients ,,,uff...

Solution:
SQLDataAdapter. Fill(DS,"Emp")

If DS.Tables("Emp" ).Rows.Count > MyDataGrid1.Pag eSize then
MyDataGrid1.All owPaging = True
Else
MyDataGrid1.All owPaging = False
End if

MyDataGrid1.Dat aBind()

Any better ways?

ya perhaps this could have been reduced to one line also eg.

MyDataGrid1.All owPaging = ( DS.Tables("Emp" ).Rows.Count > MyDataGrid1.Pag eSize )

Anything better then this?

Regards
Jignesh Desai
www.dotnetjini.com

Jan 24 '06 #2
Hi Jignesh,

Another means is use the DataGrid's PreRender event and set the
DataGrid.PagerS tyle.Visible according to its current page count. e.g:

protected void dgPage_PreRende r(object sender, EventArgs e)
{
if (dgPage.PageCou nt == 1)
{
dgPage.PagerSty le.Visible = false;
}
}
This can make our code just specific to the DataGrid without put in some
other page wide event.....

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Edwin Knoppert" <in**@pbsoft.sp eedlinq.nl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Subject: Re: ASP.NET:: Paging on Demand
| Date: Tue, 24 Jan 2006 22:11:50 +0100
| Organization: QinIP
| Lines: 117
| Message-ID: <dr**********@a zure.qinip.net>
| References: <es************ **@TK2MSFTNGP12 .phx.gbl>
| NNTP-Posting-Host: h8441197235.dsl .speedlinq.nl
| Mime-Version: 1.0
| Content-Type: multipart/alternative;
| boundary="----=_NextPart_000_ 0016_01C62133.2 D11FC80"
| X-Trace: azure.qinip.net 1138137108 8548 84.41.197.235 (24 Jan 2006
21:11:48 GMT)
| X-Complaints-To: ab***@qinip.net
| NNTP-Posting-Date: Tue, 24 Jan 2006 21:11:48 +0000 (UTC)
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Path:
TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!ne wsfeed00.sul.t-online.de!t-onli
ne.de!newsfeed. freenet.de!213. 132.189.2.MISMA TCH!multikabel. net!feed20.mult i
kabel.net!news2 .euro.net!azure .qinip.net!not-for-mail
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3732 73
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Agreed, but you can also extend this paging template with a checkbox to
disable it.
| I did a similar thing but outside the grid.
| "Jignesh Desai" <ji***********@ hotmail.com> schreef in bericht
news:es******** ******@TK2MSFTN GP12.phx.gbl...
| Info::
| Most of you must have worked on paging feature of DataGrid. its works
fine as long as you have more no of records to show, but if you have
configured 20 records per page and no of records you retrieved is less then
20 then also pager gets rendered at the bottom of the grid showing "1".
most of us do not bother about it , but Clients ,,,uff...
| Solution:
| SQLDataAdapter. Fill(DS,"Emp")
| If DS.Tables("Emp" ).Rows.Count > MyDataGrid1.Pag eSize then
| MyDataGrid1.All owPaging = True
| Else
| MyDataGrid1.All owPaging = False
| End if
| MyDataGrid1.Dat aBind()
| Any better ways?
| ya perhaps this could have been reduced to one line also eg.
| MyDataGrid1.All owPaging = ( DS.Tables("Emp" ).Rows.Count >
MyDataGrid1.Pag eSize )
| Anything better then this?
| Regards
| Jignesh Desai
| www.dotnetjini.com
|

Jan 25 '06 #3

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

Similar topics

3
1249
by: Kenneth | last post by:
Hi, I have an asp.net app that users would like to print out on paper, but the items in the grid are sometimes more than the height of the paper so the grid is divided onto several pages. I can demand my users to use IE4+. Is there some way to repeat the grid headers on top of
1
1409
by: Danny Ni | last post by:
Hi, We use ASP.Net datagrid paging a lot and we have been experiencing "Index out of bound" error messages when we click on rows of datagrid on differnet pages every now and then. The problems do not apear to be consistent, they could happen anywhere, anytime. We only use datagrid's default paging ability. That is, set AllowPaging property to true and write a handler for PageIndexChanged. Somebody told me this is datagrid's...
2
2217
by: asad | last post by:
Hello friends, i am designing a ASP.NET page where i want to use custom paging bcoz data is too heavy so pls tell me how can i use custom paging in ASP.NET Thanks
2
1785
by: asad | last post by:
hello friends, how ru all I want to create a custom paging logic in ASP.NET with a next link for example if i have 100 pages record so i want to show 6 pages link on page one and next link like that 1 2 3 4 5 6 <Next>
22
3011
by: Zen | last post by:
Hi, My production machine has 2G of memory, when aspnet_wp.exe goes up to about ~1.2G of memory usage, I start get out-of-memory exception. Other processes don't use as much memory and I added all the peak memory usage of all the processes (including aspnet_wp.exe), it goes up to no more than 1.5. How is that possible? Would anyone know please help? thanks!
3
4979
by: Sachin | last post by:
Hi All, I am using ASP.NET 2.0 Tree control to display hierarachical data. However because of the size of the data, tree takes ages to load on the browser. For that reason, I want to build custom paging solution similar to custom paging in datagrid/gridview...
2
2439
by: Daniel Di Vita | last post by:
I have created an ASP.NET page that allows the user to page through a result set. I need to expand on this. On that same page I a filed where the user can type in a search string. When they click a button ALL the results will be returned and the closest match to the search string will be highlighted. The approach I am taking to page the data is to put the keys/indexes into an array then create another data reader based on those results to...
2
6446
by: farhad13841384 | last post by:
Hi , I Hope You fine. I have some problem with this code for paging in asp.net this bottom code work correctly without any error but when I try to place separate code in .VB file then error is begin and occured .I want to separate this code and compiling .vb code using VBC.exe later .(bin/paging.dll) when do it like me so you retrive only < Previous Page Next Page > in your web browser and you don't retrive list Of data in your web browser....
11
9809
by: Usenet User | last post by:
..NET 1.1/2.0 I have a need to display high-resolution scrollable images in a .NET application (Windows Forms). One well known solution is to create a Panel with AutoScroll set to "true" and then add a PictureBox or another Panel to it, that is used to display the image. The above approach works, however, to my surprise, .NET GDI+-based graphics are not really hi-res friendly.
0
8603
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
9157
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...
0
9023
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8893
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7721
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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
4366
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
4615
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1999
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.