Gridview Item DropdownList控件序列号分配 [英] Gridview Item DropdownList control Serial number allocation
本文介绍了Gridview Item DropdownList控件序列号分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个带有下拉列表控件的gridview,其中包含seqno表格1-10。
如何绑定gridview下拉列表1-10值的值,一旦使用该值,它不应该显示在另一行dropdownlist中。在编辑时,如果我正在更改seqno,它应该更新另一行下拉列表的现有序列号(如果它存在于另一行)反之亦然..
解决方案
您需要处理DropDownList SelectedIndexChanged
。在该事件中获取该DropDownList
的选定值。
然后循环遍历<$ c的所有行$ c> GridView 并在里面删除所有DropDownLists
中的特定值。
另一方面,在更新DropDownList
的值时,您需要从某些数据源或其他东西获取先前的选项值。因此,您可以做的是,最初当您获得所有项目时,只需将其存储在Session
中。更新SelectedIndexChanged
中的所有选项时,只需比较Session中的数据并相应地添加/删除DropDownLists
。
Hi All,
I have a gridview with dropdownlist control filled with seqno form 1 -10.
How to bind gridview dropdown values from 1-10 scale and once the value is used it shouldn't be shown in another row dropdownlist.And on edit, if i am changing seqno it should update the existing serial number of another row dropdownlist if it exist for another row then.and vice versa..
解决方案
You need to handle theDropDownList SelectedIndexChanged
. Inside that event get the selected value of thatDropDownList
.
Then loop through all the rows ofGridView
and inside that remove that particular value from all theDropDownLists
.
On the other hand, while updating the value ofDropDownList
, you need to get the previous option value from some data source or something. So, what you can do is that, initially when you get all the items, just store that inSession
. While updating all the options inside theSelectedIndexChanged
, just compare the data from the Session and add/remove fromDropDownLists
accordingly.
这篇关于Gridview Item DropdownList控件序列号分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文