选中checkBoX时,在gridview表的顶部列出特定行 [英] list a certain row at the top of gridview table when a checkBoX is checked

查看:81
本文介绍了选中checkBoX时,在gridview表的顶部列出特定行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jobTable的gridview,其中有一个复选框"IsTop". (jobTable内的一列),这意味着它们将列在最新职位发布"列表的顶部.哪个是实现此功能的最佳方法?

我的想法是确保是否有1行"IsTop"选中后,与其他行关联的所有其他checkBox将变得不可见,并找到该JobID作为startRowIndex.但是,我该如何编写代码?

w要按IsTop降序排列吗?如果所有分割行都分配了Istop = true,并且Istop是一个表列为boolean,则只有true或false

I have a gridview of jobTable which has a checkbox "IsTop" (a bit column inside jobTable), which means they will be listed at the top in the list of "latest job postings". Which is the best way to implement this function?

My idea is to ensure if 1 row "IsTop" checked, all other checkBox assocated with other rows will become invisible, and find that JobID as the startRowIndex. But how do I write that code?

w to orderby IsTop descending? What if severval row all assigned Istop=true, and Istop is a table column boolean,only true or false

推荐答案

该描述不是很清楚,但是我会怎么办? "我会猜你在做什么.

GridView不支持就地固定"记录.您也不能使任意行不可见.当用户进行更改时,您必须将要显示的数据管理到一个单独的数据表中,该表仅包含要显示的记录.根据您的应用程序正在执行的操作以及您允许用户执行的操作,这可能会导致服务器大量回发,因此您必须自己评估一下."
Your description isn''t very clear, but I''ll take a guess at what you''re doing.

The GridView doesn''t support "pinning" records in place. You also cannot make arbitrary rows invisible. You''d have to manage the data you want to show into a seperate datatable containing only the records you want to show, as the user makes changes. Depending on what you''re app is doing and what you''re allowing your users to do, this can result in a bunch of postbacks to the server, so''ll have to evaluate this yourself.


好,我对您的问题的理解是,您希望在Gridview顶部显示"IsTop"字样的行.对吧?

好简单,在查询数据时,您需要按"IsTop"(以及您想要的其他任何对象)对它们进行排序.这样,您将可以确保这些数据排在最前面.此外,您可以为这些项目在网格视图中应用不同的行样式,以将它们与其他项目区分开.
Ok, My understanding of your problem is that you want to show "IsTop"''ed rows on top of your Gridview. Right?

Well that is easy, you need to sort them by your "IsTop" (and any other you want) when you querying your data. That way you will be guaranteed the those data come on top. Further more you can apply different row styles to your gridview for those items to distinguish them from the rest.


这篇关于选中checkBoX时,在gridview表的顶部列出特定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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