Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个在某些值上禁用并在某些值上启用的下拉列表。在保存期间我想检查它是否被禁用。
我通过以下方式禁用下拉列表:
ddlSectorRailway.Attributes.Add("disabled","disabled");
如何检查下拉菜单是否被禁用?我只想在启用下拉值时才保存它。如何在 C# 中做到这一点?
谢谢,
你应该这样编码:
ddlSectorRailway.Enabled = false;
然后在保存时您可以检查:
if(ddlSectorRailway.Enabled) { //save code }
if(ddlSectorRailway.Attributes["disabled"]!=null) { if(ddlSectorRailway.Attributes["disabled"]=="disabled") { //your code } }