Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
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
Posted
Updated 21-May-14 21:58pm
v2

This is the simplest code on how to disable controls...
VB
TextBox1.Enabled=False
 
Share this answer
 
v2
Comments
Marco Bertschi 22-May-14 3:59am    
+5
Karen Mitchelle 22-May-14 21:03pm    
thanks. :)
Kornfeld Eliyahu Peter 22-May-14 14:31pm    
My 5!
We may also add - for pure educational purpose - that 'disabled' attribute is not for all elements and it's a 'valueless' attribute, that means when it presented it is on if not presented it is off...
Karen Mitchelle 22-May-14 21:05pm    
Thanks.

Yeah, I totally agree. :)
disabled is not a style, it is an attribute.

control.Attributes....
 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 22-May-14 14:29pm    
And it not for every element...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900