Adding a telerik through codebehind with custom assembly skin is throwing an error

1 Answer 23 Views
SkinManager
Aron Calder
Top achievements
Rank 1
Aron Calder asked on 01 Oct 2024, 10:35 PM

Hi,

I have built a custom assembly skin, and I know that it is working correctly as the controls on the page are showing the correct skin.

However, if I am to add a simple control telerik raddatepicker like the below

protected void Page_Load(object sender, EventArgs e)
{
    RadDatePicker oDate = new RadDatePicker();
    oDate.Skin = "IWCL";
    pnlMain.Controls.Add(oDate);
}

The following error is thrown

Telerik.Web.UI.DatePickingInput with ID='dateInput' was unable to find an embedded skin with the name 'IWCL'. Please, make sure that the skin name is spelled correctly and that you have added a reference to the Telerik.Web.UI.Skins.dll assembly in your project. If you want to use a custom skin, set EnableEmbeddedSkins=false.

I am pretty sure that there isn't any issue with the custom assembly, as without adding a control through a code behind, the page runs ok without any error.

You can reproduce the same error by using the sample project that telerik have provided in the below

https://docs.telerik.com/devtools/aspnet-ajax/styling/controlling-visual-appearance/how-to-load-skins-from-external-assemblies?_gl=1*p0oqmn*_gcl_au*MTU5OTE5Mjc3Mi4xNzIzMjIyMDU5*_ga*ODM2NTIzMjk2LjE3MjMyMjIwNTk.*_ga_9JSNBCSF54*MTcyNzgxODEwNC4yOS4xLjE3Mjc4MjIwNTUuNTAuMC4w

Thank you and I look forwards to hear from you

Aron Calder
Top achievements
Rank 1
commented on 01 Oct 2024, 11:00 PM | edited

Hi,

It looks like even when you do it as a normal control in the page (Not adding through code behind), the issue still exist.

It seems that the reason for this is since I am using the skin included in the telerik folder as a base, there isn't any css for DatePicker, there is only css for Calendar, but including that in the RadDatePicker class still throwing an error

Is there any example of RadDatePicker class that I can use to make this work?

1 Answer, 1 is accepted

Sort by
0
Vasko
Telerik team
answered on 04 Oct 2024, 06:49 AM

Hello Aron,

The error is thrown because a custom skin is used and the EnableEmbeddedSkins property is still set to true. When custom skins are used, the property should be set to false for the control to load the necessary files.

I hope this helps you out.

Regards,
Vasko
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Aron Calder
Top achievements
Rank 1
commented on 04 Oct 2024, 08:28 AM

Hi Vasko,

Thank you for your reply.

But the custom skin that I used, i have put them in custom assembly as I mentioned before.

So if I turn EnableEmbeddedSkins to false, it would not worked.

For other controls it works perfectlly

Vasko
Telerik team
commented on 09 Oct 2024, 07:09 AM

Hi Aron,

Do you have a SkinManager on the page? It is used to reference the assembly you have created. If you don', try adding it to the page and see if that will load the custom skin:

<telerik:RadSkinManager runat="server" ID="RadSkinManager1" ShowChooser="true">
    <Skins>
        <telerik:SkinReference Assembly="YourCustomSkinAssemblyName" />
    </Skins>
</telerik:RadSkinManager>

Please refer to the following articles for additional information:

Regards,
Vasko
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Tags
SkinManager
Asked by
Aron Calder
Top achievements
Rank 1
Answers by
Vasko
Telerik team
Share this question
or