RadSkinManager vs. dynamically loaded controls

2 posts, 0 answers
  1. Gunnar
    Gunnar avatar
    28 posts
    Member since:
    Aug 2009

    Posted 23 Apr 2014 Link to this post

    I have a RadSkinManager definition like this:

    <telerik:RadSkinManager runat="server" ID="RadSkinManager1" ShowChooser="True" Skin="Default" >
            <telerik:TargetControl ControlsToApplySkin="RadComboBox"
                Skin="Glow"  Enabled="true"  />
            <telerik:TargetControl ControlsToApplySkin="RadButton"
                Skin="Black"  Enabled="true"  />

    Instead of using MasterPages the site is built on Controls (ascx) dynamically loaded depending on requested service. When using the definition above, all controls have the Default skin applied except RadComboBoxes and RadButtons that are statically defined on the default.aspx page (so far, so good). RadComboBoxes and RadButtons on dynamically loaded controls have the Default skin applied until the first postback, at which time they get their explicitly assigned skins applied.

    I have tried to add the following line to the Page_PreRender method on the default.aspx page:

    this.RadSkinManager1.Skin = "Default";

    But this doesn't make any difference.

    Is something else required in order to get dynamically loaded controls to get the assigned skin on first load instead of on first postback?

    I have also noted that if the SkinChooser is displayed, All RadComboBoxes are correctly styled after the first postback. If the SkinChooser is not displayed (and no other changes made), all RadComboBoxes lose their styling altogether after first postback.
  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 28 Apr 2014 Link to this post

    Hello Gunner,

    Based on the provided information I suppose that you are loading the UserControls into one main Content Page in your application. In this case I would suggest you top place the RadSkinManager on the main Content Page and add programmatic target controls to it for example:

    Content Page C#:
    protected void Page_Load(object sender, EventArgs e)
                //Get the WebUserControl
                UserControl MyControl = (UserControl)Page.FindControl("WebUserControl1");
                //Get user control's button and label
                RadButton MyButton = (RadButton)MyControl.FindControl("RadButton1");
                RadComboBox MyCombo = (RadComboBox)MyControl.FindControl("RadComboBox1");
                RadSkinManager1.ApplySkin(MyButton, "Black");
                RadSkinManager1.ApplySkin(MyCombo, "Glow");

    Give this a try and let me know if it helps.

    Maria Ilieva

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top