如何在ASP.NET中禁用下拉列表 [英] How to disable dropdownlist in ASP.NET

查看:89
本文介绍了如何在ASP.NET中禁用下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带自动搜索的下拉列表,点击该按钮时有一个按钮另一个动态创建的下拉列表。并且我想根据某些条件禁用它。



生成下拉列表后生成跨度



< span class =custom-combobox>





我尝试过:



i已经尝试了ddlBrand0.Enable = false

但它不起作用



请帮帮我

i have a dropdownlist with auto search and there are a button when click on that button another dropdownlist creating dynamically. and i want to disable it based on some condition.

after generating dropdownlist it generate span




What I have tried:

i have tried ddlBrand0.Enable=false
but it not working

Please help me

推荐答案

如果你在后面的代码中创建下拉列表并且想要仅在代码后面禁用它,那么你应该使用Enabled属性并将其设置为false。



If you are creating dropdown in code behind and want to disable it in code behind only, then you should use "Enabled" property and set it to false.

ddlBrand0.Enabled=false





如果你试图禁用它JavaScript然后执行以下操作。





And if you are trying to disable it from JavaScript then do the following.

document.getElementById("clientdropdownid").disabled = true;


这篇关于如何在ASP.NET中禁用下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆