Tip::Paging on Demand.....

Discussion in 'ASP .Net' started by Jignesh Desai, Mar 10, 2005.

  1. 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
     
    Jignesh Desai, Mar 10, 2005
    #1
    1. Advertising

  2. Jignesh Desai

    Ily Guest

    I usually Inherits from the datagrid and add this feature. Seems to do
    the trick
     
    Ily, Mar 10, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. robertm
    Replies:
    1
    Views:
    297
    Dino Chiesa [MSFT]
    Aug 12, 2003
  2. Jens Klingelhöfer

    How to send a website to a client without demand?

    Jens Klingelhöfer, Nov 30, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    332
    Steve C. Orr [MVP, MCSD]
    Dec 1, 2003
  3. Jignesh Desai

    ASP.NET:: Paging on Demand

    Jignesh Desai, Jan 24, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    795
    Steven Cheng[MSFT]
    Jan 25, 2006
  4. David Mark
    Replies:
    16
    Views:
    939
    Scott Sauyet
    Nov 11, 2011
  5. David Mark
    Replies:
    58
    Views:
    1,520
    David Mark
    Dec 6, 2011
Loading...

Share This Page