Suppressing Paging Numbers on Short DataGrids

by fwhagen Thu, 21 August 2008

I hate seeing a solitary "1" on the bottom of a paged datagrid because the dataset is too short to have more than one page.  You don't really want to turn off paging but suppress the "1" when it is not needed.

Use this code to do just that when binding the grid:

        if (dgEmployee.Items.Count < dgEmployee.PageSize)
            dgEmployee.PagerStyle.Visible = false;

Keywords:

Filed Under: .NET

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

TextBox

RecentPosts