Click here to Skip to main content
15,882,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 17-Mar-11 4:29am

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.
Share this answer
Espen Harlinn 17-Mar-11 19:38pm    
Good advice, my 5
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.
Share this answer
Espen Harlinn 17-Mar-11 19:38pm    
Fair enough, my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900