Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Tip::Paging on Demand.....

Thread Tools

Tip::Paging on Demand.....

Jignesh Desai
Posts: n/a
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

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


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?

Jignesh Desai

Reply With Quote
Posts: n/a
I usually Inherits from the datagrid and add this feature. Seems to do
the trick

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off