I want some properties to be read-only. I am okay with the disable style on the textbox, that's standard. But why dimme the label?
Whats the best way to make the label normal again?
1 Answer, 1 is accepted
1
Accepted
Nadezhda Tacheva
Telerik team
answered on 25 Jan 2023, 07:52 AM
Hi Martin,
The built-in label is a part of the form field. If you inspect the rendering, you may notice that both the label and the input are nested in a <div class="k-form-field">.
By design, when the form field is disabled, "k-disabled" class is added to that div. In this case, its children - the label and the input - both have certain styling that indicates to the user this field is not editable.
You have two options to customize this behavior:
If you use the Enabled="false" property of the form field, the label will be disabled by default and you may apply some CSS to the label to style it as needed.
I have tried to style the label but with no luck. I can't remove the grayfilter. Could you provide some css for me?
Nadezhda Tacheva
Telerik team
commented on 27 Jan 2023, 04:49 PM
Hi Martin,
The styles for the disabled state propagate to the label from its parent <div class="k-form-field k-disabled">. The "k-disabled" class reduces the opacity of the whole field and it is not possible to override that by targeting just the label.
So, I will list another approach based on CSS. Do not use the Enabled parameter of the FormItem to mark the whole field as disabled. Instead, add your custom class to it and add styles to disable just the input and not the label.