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

How to change skin on all controls on page?

3 Answers 329 Views
Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Chris Chubb
Top achievements
Rank 1
Chris Chubb asked on 25 Sep 2009, 06:32 PM
I don't know where else to ask this, but I figured this was as good a forum as any other.

I am making a number of web user controls and each control has a property for which skin should be applied to all of the Telerik RAD AJAX controls in my web user control. Right now there are at least 15 Telerik skinnable controls on the page.

What I want to do is to write a piece of code suchly:

If (CustomSkinName <> "") Then
For Each Control In Page.Controls
If ([[Control is a Telerik Skinnable Control]]) Then
Control.EnableEmbeddedSkins = False
Control.Skin = CustomSkinName
End If
Next Control
End If

First question is: How do I determine "Control is a Telerik Skinnable Control"? 

Secondly, it would appear that Grids and Charts don't share any common ancestor that has the skinning properties. What would the proper ancestor class be? Is there a better way? Reflection?

3 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 25 Sep 2009, 09:31 PM
Have you looked into using a RadSkinManager?
0
Chris Chubb
Top achievements
Rank 1
answered on 26 Sep 2009, 12:10 AM
I was under the impression that the RadSkinManager could only set the skin property for built-in skins, not custom skins that I have created. Also, RadSkinManager can only have one instance per page and I am working with ascx UserControls that may have more than one of them on a page. Am I wrong in my assumptions?
0
Dimo
Telerik team
answered on 28 Sep 2009, 09:50 AM
Hello Chris,

Yes, RadSkinManager sets embedded skins only.

In order to check whether a control is a Telerik skinnable web control in the IF statement, you should check whether the control implements the ISkinnableControl interface. All our skinnable controls implement it, including RadGrid and RadChart.

Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Visual Style Builder
Asked by
Chris Chubb
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Chris Chubb
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or