如何在gridview顶部显示特定的数据表项 [英] How to show a particular datatable item at the top of the gridview
本文介绍了如何在gridview顶部显示特定的数据表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将数据表绑定到网格视图时,我有一个带有一些值的数据表如何绑定gridview顶部的特定项目。
I have a datatable with some values when i bind that datatable to grid view how can i bind a particular item at the top of the gridview.
推荐答案
你好Udayams。
您没有提供代码或数据库的任何细节。只需输入您的代码或数据库详细信息,以便我可以尝试解决您的问题。
据我所知,这里我写的是你的问题的逻辑
除此之外我给你发了一个小例子。你应该优化你的数据表查询
例如:
Hi Udayams.
You didn't gave any details of your code or Database. Just put your code or Database details so that i can try to solve out your problem.
As i understood, here i am writing some logic of your problem
Other than this here i am sending you a little example.You should refine your datatable query like that
Example:
create table #t(sn int null,name varchar(10) null,code varchar(10) not null)
insert into #t values (1,'a','100')
insert into #t values (2,'b','200')
insert into #t values (3,'c','300')
insert into #t values (4,'d','400')
insert into #t values (5,'e','500')
--select * from #t
- - 如果你想要具有名称c的行首先不使用order by子句或给予任何条件
--now you want that "the row with name c come first without using order by clause or giving any where condition"
select * from #t where code='300'
union all
select * from #t where code not in('300')
输出:
OUTPUT:
3 c 300 (this is your particular row which you want on grid in first row)
1 a 100
2 b 200
4 d 400
5 e 500
这篇关于如何在gridview顶部显示特定的数据表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文