重新选择原始选定值时,DropDownList selectindexchanged 不会触发
我有一个表格,其中有两个下拉菜单。 一个人的决定会解雇另一个人。
基本规则是:
Drop Down A ->选择项目 1,2 或 3。下拉 B 加载列表 1 下拉 A ->选择项目 4,5 或 6。下拉 B 加载列表 2
这在第一次加载和保存表单时效果很好。问题是我编辑的时候。假设我在下拉菜单 A 中选择并保存了项目 3。
编辑时:
如果我更改下拉菜单 A,则每次更改时都会触发选择更改事件,除非我重新选择已保存的内容。 这让我陷入这样一种情况:我可以在下拉菜单 A 中选择 3,但在下拉菜单 B 中却留下了错误的列表,因为该事件不会在该选择上重新触发。
我已经尝试了我能想到的所有技巧,但似乎无法解决这个问题。
有人有什么建议吗?
(我们尝试过单选按钮列表,它也有同样的问题。在变量中设置值并尝试重置控件以清除它认为的原始值也不起作用。)
I have a form in which I have two drop downs.
A decision in one fires the other.
The basic rule is:
Drop Down A -> select items 1,2 or 3. Drop down B loads list 1
Drop Down A -> select items 4,5 or 6. Drop down B loads list 2
This works fine on first load and save of the form. The problem is when I edit. Lets say I selected and saved item 3 in Drop Down A.
On Editing:
If I change Drop Down A, the select changed event fires every time I change it except when i reselect what was saved.
It leaves me in a situation where I can choose 3 in Drop Down A but are left with the wrong list in Drop Down B as the event doesn't refire on that selection.
I've tried every trick I can think of but I can't seem to get around this issue.
Anyone have any suggestions?
(We've tried radiobutton lists and its the same issue. Setting the value in a variable and attempting to reset the control to clear what it thinks the original value is doesn't work either.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定我是否完全理解您的问题,但请考虑在您的列表中添加额外的空白或虚拟项目(--请选择--)并将其作为默认选定的项目。这样,一旦用户选择了有效的项目,它就会始终与原始项目发生变化。
Not sure that i've understood your problem completely, but consider to add an extra blank or dummy item(-- please select --) to your list and have that be the default selected item. That way as soon as a user selects a valid item it will always have changed from the original item.