如何使DropDownList在asp.net中只读 [英] How to make DropDownList as read only in asp .net

查看:553
本文介绍了如何使DropDownList在asp.net中只读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将DropDownList设为只读在asp .net

解决方案

Code Behind:添加属性已禁用



 DropDownList1.Attributes.Add(禁用,禁用); 





客户端:



 


(#DropDownList1)。attr(disabled,disabled );


 <   asp:dropdownlist     id   =  DropDownList1    runat   =  server   已启用  = 错误    xmlns:asp   = #unknown >  
< < span class =code-leadattribute> / asp:dropdownlist >





或者在运行时更改它:



 DropDownList1.Enabled = ; 


How to make DropDownList as read only in asp .net

解决方案

Code Behind: Just add attribute disabled

DropDownList1.Attributes.Add("disabled", "disabled");



Client Side:


("#DropDownList1").attr("disabled","disabled");


<asp:dropdownlist id="DropDownList1" runat="server" enabled="False" xmlns:asp="#unknown">
    </asp:dropdownlist>



Or change it at runtime:

DropDownList1.Enabled=false;


这篇关于如何使DropDownList在asp.net中只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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