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

RadSkinManager vs. dynamically loaded controls

1 Answer 106 Views
SkinManager
This is a migrated thread and some comments may be shown as answers.
Gunnar
Top achievements
Rank 1
Gunnar asked on 23 Apr 2014, 10:48 AM
I have a RadSkinManager definition like this:

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

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.

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 28 Apr 2014, 09:01 AM
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.


Regards,
Maria Ilieva
Telerik
 

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.

 
Tags
SkinManager
Asked by
Gunnar
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or