GridView:如何设置要显示的行数 [英] GridView: How to set the number of rows to display

查看:22
本文介绍了GridView:如何设置要显示的行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I would like my grid view to display only 3 rows any ideas on how I can achieve this?

Thanks

解决方案

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)).

这篇关于GridView:如何设置要显示的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆