1

I have a GridView and ObjectDataSource set up to do custom paging and everything was fine. Now the client wants a 'show all' button. In the event handler for this button, what can I do to achieve this?

Thanks for your time.

Muhammad Akhtar
  • 51,913
  • 37
  • 138
  • 191
Keith Myers
  • 1,379
  • 2
  • 15
  • 29

1 Answers1

0

If you want show all records on a button click, then its better to set AllowPaging = false on the button's Click handler. It will simply disable the paging feature and bind all the records to the gridview:

Gridview1.AllowPaging = false;
Gridview1.DataBind();
Off The Gold
  • 1,228
  • 15
  • 28
Muhammad Akhtar
  • 51,913
  • 37
  • 138
  • 191
  • Since the OjbectDataSource uses custom paging I had to also set the number of rows to take as the number that exist via a query, but your answer certainly got me past the hard part. Thanks for the help. – Keith Myers May 12 '11 at 18:29