如何禁用控件 [英] How to disable the controls

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

问题描述

Dim control As Object = Me.FindControl(ControlId)
       If (ValuStatus) Then
           If DbValue.ToUpper() = SelectedValue.ToUpper Then
               control.Style.Add("disabled", "true")

           Else
               control.Style.Add("disabled", "false")


           End If
       Else
           If DbValue.ToUpper <> SelectedValue.ToUpper Then
               control.Style.Add("disabled", "true")
           Else
               control.Style.Add("disabled", "false")
           End If
       End If

推荐答案

这是有关如何禁用控件的最简单的代码...
This is the simplest code on how to disable controls...
TextBox1.Enabled=False


禁用的不是样式,而是属性.

control.Attributes ....
disabled is not a style, it is an attribute.

control.Attributes....


这篇关于如何禁用控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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