GridView: How to set the number of rows to display
问题 I would like my grid view to display only 3 rows any ideas on how I can achieve this? Thanks 回答1: Enable Paging and set the GridView's PageSize to 3. How to: Enable Default Paging in the GridView Web Server Control If you want to restrict your GridView to show only 3 rows without paging, you need to use a DataSource with only 3 records (f.e. via SQL- TOP -Clause or Limit in MySQL or LINQ's Take(3) ). 回答2: If you can limit the records in your query, then that's the best approach. However, if