Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Tip::Paging on Demand.....

 
 
Jignesh Desai
Guest
Posts: n/a
 
      03-10-2005
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


 
Reply With Quote
 
 
 
 
Ily
Guest
Posts: n/a
 
      03-10-2005
I usually Inherits from the datagrid and add this feature. Seems to do
the trick

 
Reply With Quote
 
 
 
Reply

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




Advertisments