This is a migrated thread and some comments may be shown as answers.

Disabling Controls on a Form

3 Answers 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Khizar Khan
Top achievements
Rank 1
Khizar Khan asked on 05 Jul 2010, 11:34 AM
Hi,

I want to disable the most of the controls in the form. is there a way to do it for all of them at the form level.

also, I have a requirement of NOT greying out the controls when they are disabled.

thanks for your advice and help in advance.

regards,
Khizar

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 06 Jul 2010, 01:57 PM
Hello Khizar Khan,

Thank you for writing.

Our controls provide a Visible property for each control/element except for the main form. Once you set it for a certain element to false this element and its descendants will not appear. For instance, if you have a panel with few buttons, and when set the Visible of the panel to false, the panel and the buttons will hide.

The only way to hide all elements in a Form is when you have your MainForms' isMDIcontaier enabled, and you have inserted some child forms in there. Now you can call the child form Visible property and it will hide the form and its children.

Here you can find some more information about hiding elements. 

I hope you find this information helpful. 

 

Greetings,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Khizar Khan
Top achievements
Rank 1
answered on 09 Jul 2010, 03:26 PM
Thanks,

but I dont want to change the visibility, I want to disable them without changing their appearance.

Regards,
Khizar
0
Nikolay
Telerik team
answered on 09 Jul 2010, 03:43 PM
Hi Khizar,

Please accept our apologies for misunderstanding you.

You can set the Enabled property of all controls on a form at once by setting the Enabled property of the form itself:
this.Enabled = false;

As to your second requirement, Telerik Presentation Framework provides a way to keep the original look of RadControls while they are disabled. To do so, you need to set the UseDefaultDisabledPaint of the controls' RootElements to false, for example:
this.radButton1.RootElement.UseDefaultDisabledPaint = false;

I hope this helps. If you have additional questions, feel free to contact me.

Sincerely yours,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Khizar Khan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Khizar Khan
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or