最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net 遍历指定的控件类型 设置为只读
时间:2013-05-08 编辑:简简单单 来源:一聚教程网
代码如下 | 复制代码 |
protected void TurnControlsReadOnly() { foreach (Control obj in form1.Controls) { if (obj is TextBox) { //obj.Attributes.Add("readonly", "true"); ((TextBox)obj).ReadOnly = true; } } foreach (Control obja in form1.Controls) { if (obja is DropDownList) { ((DropDownList)obja).Enabled = false; } } foreach (Control objb in form1.Controls) { if (objb is Button) { ((Button)objb).Visible = false; ((Button)objb).Enabled = false;
} } foreach (Control obja in form1.Controls) { if (obja is RadioButtonList) { ((RadioButtonList)obja).Enabled = false; } }
dropSort.Enabled = false; //btnUPloadIma.Visible = false; ddlCategory.Enabled = true; btnSaveCategory.Visible = true; btnSaveCategory.Enabled = true; txtOtherCategory.ReadOnly = false; txtSortOther.ReadOnly = true;
for (int i = 0; i < dlstProductImage.Items.Count; i++) { dlstProductImage.Items[i].FindControl("lbtnDelete").Visible = false; } fldBuyInfoImage.Visible = false; } |
相关文章
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24
- C语言中atoi函数模拟实现介绍 10-18
- .Net反向代理组件Yarp用法介绍 10-10
- .NET使用YARP通过编码方式配置域名转发实现反向代理教程 10-10