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

Tip::Paging on Demand.....

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...but after all client is a
client...if you also encounter such things this is how you solve
SQLDataAdapter.Fill(DS,"Emp")

If DS.Tables("Emp").Rows.Count > MyDataGrid1.PageSize then
MyDataGrid1.AllowPaging = True
Else
MyDataGrid1.AllowPaging = False
End if

MyDataGrid1.DataBind()

I do hate to write these extra lines of code, I hope that .NET team at
Microsoft will incorporate this feature inbuilt in DataGrid itself in their
next release. what do others say...? any better ways?

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

MyDataGrid1.AllowPaging = ( DS.Tables("Emp").Rows.Count >
MyDataGrid1.PageSize )

Anything better then this?

Regards,
Jignesh Desai
www.dotnetjini.com
Nov 19 '05 #1
1 1239
Ily
I usually Inherits from the datagrid and add this feature. Seems to do
the trick

Nov 19 '05 #2

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

Similar topics

1
by: Luka POZVEK | last post by:
Hello! I have a problem regarding ADO paging. I have a simple .mdb database to which i connect through ADO. It contains 42 records (each has 2 fields). I've set up a asp code, which "pages"...
1
by: Randy | last post by:
Hello, I've got an ASP app. I have a simple datagrid. If I don't use column templates I can easily set up the datagrid to use paging by creating a PageIndexChanged event and putting this code in...
0
by: Mauricio Bastos | last post by:
I have found examples on how to create a DataList Paging iin C#. However , I couldnt find any tip in how to do it with VB.net . Any one has a tip ? Mauricio
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...
4
by: Jim Seymour | last post by:
Hi, Environment: SunOS 5.7 Generic_106541-29 sun4u sparc SUNW,UltraSPARC-IIi-Engine Postgresql-7.4.6 Build config: --with-java --enable-thread-safety gcc version 3.3.1 less-381 readline-4.3
2
by: Jeff | last post by:
Hey ASP.NET 2.0 GridView have AllowPaging & PageSize for the letting the GridView span multiple pages. But is the same allowed on a Repeater control? I didn't see any properties like...
15
by: kostas | last post by:
Hi, Trying to dump a set<int(s) in a vector (v) my guess was that v.insert(v.end(),s.begin(),s.end()) would be at least as efficient as copy(s.begin(), s.end(), back_inserter(v)) It turn out...
4
by: snowrupa | last post by:
my .cs file is using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using...
2
ADezii
by: ADezii | last post by:
This week's Tip is basically geared to Power Access Users and Gurus who demand the ultimate in efficiency within their Applications. It involves an undocumented feature of Jet 4, and is a technique...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.