且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在c#中获取禁用下拉列表的选定值

更新时间:2021-07-24 22:24:21

如果您尝试在服务器上读取第二个下拉列表(禁用的)的值,您将永远无法读取更新的值,因为禁用的数据控件不会从客户端回发到服务器.

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.

您应该在将数据发布到服务器之前启用下拉列表,或者使用隐藏控件来保存已禁用下拉列表的数据.

You should either enable the dropdown before posting your data to server or use hidden controls to hold data of your disabled dropdown.