使用c#在asp.net中的gridview [英] gridview in asp.net with c#

查看:98
本文介绍了使用c#在asp.net中的gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在网格视图中只显示10个值,而不使用带有c#的asp.net中的分页。

how to show only 10 values in gridview without using paging in asp.net with c#.

推荐答案

从数据源中选择前10行并分配给gridview -

http://msdn.microsoft.com/en-us /library/aa479339.aspx [ ^ ]

http://www.dotnetspider.com/ resources / Category518-ASP.NET-GridView.aspx [ ^ ]
Select the top 10 rows from the data source and assign to the gridview -
http://msdn.microsoft.com/en-us/library/aa479339.aspx[^]
http://www.dotnetspider.com/resources/Category518-ASP.NET-GridView.aspx[^]


您好,

您可以在SQL语句中使用LINQ而不是更改。鉴于链接可能对您有用。



http://stackoverflow.com/questions/787302/linq-to-sql-return-top-n-rows [ ^ ]

http://stackoverflow.com/questions/5769948/how-to-select-top -n-rows-in-a-linq-groupby [ ^ ]

使用-LINQ -10-记录 - 则 - 下一-10-寻呼http://stackoverflow.com/questions/9718117/selecting-first-10-records-then-next-10-paging-using-linq [ ^ ]
Hi,
You can use LINQ instead of change in SQL statement. Given links may be useful to you.

http://stackoverflow.com/questions/787302/linq-to-sql-return-top-n-rows[^]
http://stackoverflow.com/questions/5769948/how-to-select-top-n-rows-in-a-linq-groupby[^]
http://stackoverflow.com/questions/9718117/selecting-first-10-records-then-next-10-paging-using-linq[^]


你可以用sql查询来实现

if你想得到的只有1到10个我可以从表格中选择前10 * *
但如果你想从20到30或40到50你必须使用2个顶部查询



从表格中选择前10名id

(通过id desc从表格顺序中选择前50名)

order by id



这个查询你可以从40到50

u必须只更改数字50到你想做的最大行数和数量行你想选择你改变它首先选择希望我这可以帮助你

sry我的英语不好运气
hi you can do it with sql query
if u wanna get only 1 to 10 rowns i do with select top 10 * from tabel
but if u wanna get from 20 to 30 or 40 to 50 u must use 2 tops in query

select top 10 id
from table where id in (select top 50 id from table order by id desc)
order by id

with this query u can get from 40 to 50
u must only change number 50 to wich max row u wanna do and how many rows u wanna select u change it to first select hope i this can help u
sry for my bad english good luck


这篇关于使用c#在asp.net中的gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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