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

Dynamically changing Skin on TargetControl doesn't update page?

2 Answers 67 Views
SkinManager
This is a migrated thread and some comments may be shown as answers.
Rob Ainscough
Top achievements
Rank 1
Rob Ainscough asked on 20 Sep 2018, 12:49 AM

I'm trying to have my controls get updated when the SkinChooser changes value to some other Skin (I'm using the embedded DLL skins provided).

<telerik:RadSkinManager ID="rskmLogin" runat="server" Skin="Material" ShowChooser="True">
    <TargetControls>
        <telerik:TargetControl ControlID="rlb_Online" Skin="Metro" ControlsToApplySkin="RadLabel" />
        <telerik:TargetControl ControlID="rtb_Online" Skin="Bootstrap" ControlsToApplySkin="RadTextBox" />
        <telerik:TargetControl ControlID="rlb_Password" Skin="Metro" ControlsToApplySkin="RadLabel"/>
        <telerik:TargetControl ControlID="rtb_Password" Skin="Bootstrap" ControlsToApplySkin="RadTextBox"/>
        <telerik:TargetControl ControlID="rbn_SignIn" Skin="Glow" />
        <telerik:TargetControl ControlID="rlb_Or" Skin="Metro" />
        <telerik:TargetControl ControlID="rbn_CreateAnAccount" Skin="Glow" />
        <telerik:TargetControl ControlID="rbn_ResetPassword" Skin="Silk" />
        <telerik:TargetControl ControlID="rcb_Skins" Skin="Sunset" />
    </TargetControls>
</telerik:RadSkinManager>

 

in my code behind: 

Private Sub rskmLogin_SkinChanged(sender As Object, e As SkinChangedEventArgs) Handles rskmLogin.SkinChanged
 
    Try
 
        If e IsNot Nothing Then
 
            For Each TrgCtrl As TargetControl In Me.rskmLogin.TargetControls
 
                TrgCtrl.Skin = e.Skin
 
            Next
 
        End If
 
    Catch ex As Exception
 
        Dim ErrorLog As New DC.Errors.Log(ex)
 
    End Try
 
End Sub

 

fairly basic stuff, but my controls don't update with the newly selected skin ... what am I missing?

 

Cheers, Rob.

2 Answers, 1 is accepted

Sort by
0
Rob Ainscough
Top achievements
Rank 1
answered on 20 Sep 2018, 12:56 AM

UPDATE: this code behind did NOT work either so I'm kinda stuck at this point:

Private Sub rskmLogin_SkinChanged(sender As Object, e As SkinChangedEventArgs) Handles rskmLogin.SkinChanged
 
    Try
 
        If e IsNot Nothing Then
 
            For Each TrgCtrl As TargetControl In Me.rskmLogin.TargetControls
 
                ' TrgCtrl.Skin = e.Skin
                Dim aCtrl As Control = FindControl(TrgCtrl.ControlID)
                Me.rskmLogin.ApplySkin(aCtrl, e.Skin)
 
            Next
 
        End If
 
    Catch ex As Exception
 
        Dim ErrorLog As New DC.Errors.Log(ex)
 
    End Try
 
 
End Sub
0
Eyup
Telerik team
answered on 24 Sep 2018, 09:44 PM
Hi Rob,

Generally, when a control has manually predefined Skin, it does not get affected by the SkinChooser of the RadSkinManager. In order to change the skins of these controls dynamically depending on the chosen Skin by the user, you can set their respective Skin property individually:
Protected Sub rskmLogin_SkinChanged(sender As Object, e As SkinChangedEventArgs)
    rbn_CreateAnAccount.Skin = e.Skin
    rtb_Online.Skin = e.Skin
End Sub

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
SkinManager
Asked by
Rob Ainscough
Top achievements
Rank 1
Answers by
Rob Ainscough
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or