开发者

How do I design a method to list a certain row at the top of gridview table?

开发者 https://www.devze.com 2023-02-18 13:17 出处:网络
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

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 chec开发者_运维技巧kBox assocated with other rows will become invisible, and find that JobID as the startRowIndex. But how do I write that code?


Why not write a LINQ query and orderby IsTop descending? The results should be in the order you need then when you bind.


BookstoreDataContext db = new BookstoreDataContext();
GridView1.DataSource = db.Books.OrderBy(b => m.Title);
GridView1.DataBind();
if(CheckBox_IsTop.Checked==true)
Update IsTop in "BookLists" Where="BookID == @BookID1" 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号