How to change skin on all controls on page?

4 posts, 0 answers
  1. Chris Chubb
    Chris Chubb avatar
    7 posts
    Member since:
    Nov 2005

    Posted 25 Sep 2009 Link to this post

    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?
  2. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 25 Sep 2009 Link to this post

    Have you looked into using a RadSkinManager?
  3. DevCraft R3 2016 release webinar banner
  4. Chris Chubb
    Chris Chubb avatar
    7 posts
    Member since:
    Nov 2005

    Posted 25 Sep 2009 Link to this post

    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?
  5. Dimo
    Dimo avatar
    8321 posts

    Posted 28 Sep 2009 Link to this post

    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,
    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.
Back to Top