排序顺序通过下拉列表进行维护 [英] Sorting Order Maintain through dropdownlist
问题描述
我有一个Gridview,其中有两列,一个是ID(标签控制),另一个是排序(Dropdownlist Control)。下拉列表list具有从gridview中的1到最大行数的填充数据。类似:
ID排序顺序
001 1
002 2
003 3
004 4
现在如果我从下拉列表中更改选项.Eg我将ID 002的排序顺序从2更改为3然后排序顺序将更改,gridview将如下所示:
ID排序顺序
001 1
003 2
002 3
004 4
我需要排序顺序逻辑来在dropdownlist_selectedindexchanged事件中进行操作。还要用值更新数据库。
谢谢和问候
Hi,
I have a Gridview where there are two columns, One is ID(Label Control) and another is Sort Order(Dropdownlist Control).The dropdown list have the populated data from 1 to the max no of rows in the gridview .Like:
ID Sort Order
001 1
002 2
003 3
004 4
Now if I change the selection from the dropdown list.E.g. I change the sort order of ID 002 from 2 to 3 then the sort order will change and gridview will look like:
ID Sort Order
001 1
003 2
002 3
004 4
I need the sort order logic to manupulate this within dropdownlist_selectedindexchanged event.Also update the database with the value.
Thanks & Regards
推荐答案
那么,问题是什么?
根据网格的下拉值,设置该行定义ID的排序顺序。您需要在for循环中相应地重新调整所有后续记录的排序顺序。完成后,将其保存在数据库中。你所寻求的只是根据选择重新调整一个字段值并坚持下去。
试一试。如果您面临发布特定问题。
So, what is the issue?
Based on grid''s dropdown value, set the sort order of that rows defined ID. You would need to readjust the sort order of all the followup records accordingly in a for loop. Once done, save the same in DB. What you seek is just to readjust a field value based on selection and persist it.
Try out. Post specific issue if you face.
这篇关于排序顺序通过下拉列表进行维护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!