gpt4 book ai didi

asp.net - 禁用的下拉列表不会在回发时保留所选值

转载 作者:行者123 更新时间:2023-12-02 10:48:20 24 4
gpt4 key购买 nike

当我触发回发时,我的下拉列表出现了奇怪的行为。

如果启用下拉列表,则所选值在回发后保持不变。

但是,如果下拉列表被禁用(当用户勾选复选框时通过 JavaScript),则所选值将重置为列表中的第一项。

怎么会呢?

最佳答案

您需要手动查找该值(可能将其存储在另一个字段中),然后在后面的代码中自行设置。这是因为如果禁用某个控件,该值将不会被发送回服务器。

看看这个问题,并引用Pavan的第一个答案

how to get selected value of Disabled dropdown in c#

If you are trying to read the value of 2nd dropdown (disabled one) at server, you will never be able to read the updated value, becuase data in disabled controls will not be posted back to server from client

关于asp.net - 禁用的下拉列表不会在回发时保留所选值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14456450/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com