How to load skins from external assemblies

Thread is closed for posting
48 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 11 Mar 2011 Link to this post

    Requirements

    Telerik Product and Version used

    Telerik Web UI for ASP.NET AJAX 2018.3.910.45

    Supported Browsers and Platforms

    All browsers supported by Telerik UI for ASP .NET AJAX

    Components/Widgets used (JS frameworks, etc.)

    HTML, C#

    PROJECT DESCRIPTION


     UPDATED 

    This project is a base you can use to create custom skin assemblies for both Classic and Lightweight render modes. The process to create is described in the How to Load Skins from External Assemblies article.

  2. CE8FD5B8-D57F-4131-8A9A-47DA58D4A301
    CE8FD5B8-D57F-4131-8A9A-47DA58D4A301 avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 21 Mar 2011 Link to this post

    Does this really have to run under .Net 4.0? Or was that just what it was tested under?

    -- 
    Stuart
  3. 000585EE-7DFC-4C10-B6EB-448F2DA3AFB4
    000585EE-7DFC-4C10-B6EB-448F2DA3AFB4 avatar
    7207 posts
    Member since:
    Jul 2016

    Posted 22 Mar 2011 Link to this post

    Hi Stuart,

    The sample was built in 4.0, but you can do that with the 3.5 version as well. I updated the code's description.


    All the best,
    Georgi Tunev
    the Telerik team
  4. CE8FD5B8-D57F-4131-8A9A-47DA58D4A301
    CE8FD5B8-D57F-4131-8A9A-47DA58D4A301 avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 22 Mar 2011 Link to this post

    Cool.

    Cheers, Georgi.

    -- 
    Stuart
  5. 0DF32E97-B4E1-45C4-9BD5-BD304B5F43DE
    0DF32E97-B4E1-45C4-9BD5-BD304B5F43DE avatar
    10 posts
    Member since:
    Oct 2008

    Posted 21 Oct 2011 Link to this post

    This is getting me closer to allowing a user to select a custom skin from RadSkinManager dropdown.  However, there is an issue and I'm not sure why that is.  I downloaded the zipped project and built it.  Then I reference the Telerik.Web.UI.Skins DLL in my project.  The BlackandRed skin shows up in the RadSkinManager dropdown, but throws an error when I select it.  I was under the impression EnableEmbeddedSkins should still be set to True (either True or False it still throws the error below).  Also, I don't have a control with ID='SkinChooser'.  I added this to my web.config file.

    <!--

    Add this key to enable the skins from external assembly-->

    <add key="Telerik.Web.SkinsAssembly" value=" Telerik.Web.UI.Skins"/>

     
    Here is the error when I select BlackandRed from SkinManger dropdown.

    Telerik.Web.UI.RadComboBox with ID='SkinChooser' was unable to find embedded skin with name 'BlackAndRed'. Please, make sure that you spelled the skin name correctly, or if you want to use a custom skin, set EnableEmbeddedSkins=false.


    Can anyone assist in this issue?
  6. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 25 Oct 2011 Link to this post

    Hello Robert,

    Attached is a small sample that demonstrates how to load custom skins from a custom assembly. Hope it will prove helpful.

    Best wishes,
    Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  7. 0DF32E97-B4E1-45C4-9BD5-BD304B5F43DE
    0DF32E97-B4E1-45C4-9BD5-BD304B5F43DE avatar
    10 posts
    Member since:
    Oct 2008

    Posted 25 Oct 2011 Link to this post

    Thank you for the quick response.  However, the code sample you sent has the same error I get with my code.  I uncommented the skinmanager code and set showchooser to True, then I selected various skins and they work fine.  But when I choose Blue (which I assume is the custom skin) I get the following error. 

    Telerik.Web.UI.RadComboBox with ID='SkinChooser' was unable to find embedded skin with name 'Blue'. Please, make sure that you spelled the skin name correctly, or if you want to use a custom skin, set EnableEmbeddedSkins=false.

    I did have to upgrade the app to 4.0 framework, but I doubt that is the issue.

  8. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 26 Oct 2011 Link to this post

    Hello Robert,

    The reason for the exception you are getting is the following: when setting the skin through the skin chooser, it gets applied to all controls on the page or all controls in the SkinManager's TargetControls collection. In your case, it is the former scenario. So the skin manager will try set the Blue skin to the combo box of the SkinChooser too, but since you do not have such a skin in your custom skin assembly, it fires an exception. The solution is to either do a custom skin for the RadComboBox control (which is the more difficult solution) or set the skin chooser to render an available skin in the page's OnInit event, for example:

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
     
        RadSkinManager1.GetSkinChooser().Skin = "Default";
    }

    If you need further assistance, do not hesitate to contact us again.

    All the best, Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  9. 35DDB320-43E8-466D-9FEF-CD0E09AD4780
    35DDB320-43E8-466D-9FEF-CD0E09AD4780 avatar
    120 posts
    Member since:
    Sep 2009

    Posted 10 Jan 2012 Link to this post

    I finally figured out the process of creating and adding the custom skin assembly and have it work by studying your attached zip file. My question is how do I add my custom skin to the list of defined skins that ship in telerik's version of Telerik.web.ui.skins. If I reference telerik's dll in the assembly then my custom skin doesn't show in the skin chooser. If I reference telerik's dll in the web reference list then I also loose the custom skin. How do you combine the both the telerik predefined skins and the custom skin together so they all show up in the chooser drop down list?

      
  10. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 13 Jan 2012 Link to this post

    Hi Dennis,

    If you need both the telerik and the custom skins to be loaded into the skin chooser, you should name your custom skin assembly with a signature different from Telerik.Web.UI.Skins and reference it through the RadSkinManager control.

    Have you tried that? If so, could you send a sample application where the issue is replicated?

    Thanks in advance.

    Regards,
    Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  11. CE8FD5B8-D57F-4131-8A9A-47DA58D4A301
    CE8FD5B8-D57F-4131-8A9A-47DA58D4A301 avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 13 Jan 2012 Link to this post

    Tsvetoslav, I think that this article could easily benefit from the addition steps needed to achieve this. -- Stuart
  12. 35DDB320-43E8-466D-9FEF-CD0E09AD4780
    35DDB320-43E8-466D-9FEF-CD0E09AD4780 avatar
    120 posts
    Member since:
    Sep 2009

    Posted 13 Jan 2012 Link to this post

    I got this to work using your process. I used your decompile tool and the resources are present in my version of the skin dll, but won't show in my grid. Suggestions?
  13. 35DDB320-43E8-466D-9FEF-CD0E09AD4780
    35DDB320-43E8-466D-9FEF-CD0E09AD4780 avatar
    120 posts
    Member since:
    Sep 2009

    Posted 17 Jan 2012 Link to this post

    I missed a setting the build action to embedded resource on a few files. The attached zip is the corrected project. The images for the "Blue" skin still will not load into the datagrid, even though you can see all the resources using your decompile tool and the paths match. Still stumped why the images won't load.
  14. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 18 Jan 2012 Link to this post

    Hi Dennis,

    In your mark-up in the GetWebResourceUrl you need to full name of the class over which the embedded skin attributes are applied:
    <telerik:GridTemplateColumn HeaderText="Ajax" UniqueName="Ajax">
        <ItemTemplate>
            <img id="Image1" onload="MyLoad(this,event)" src='<%# Telerik.Web.SkinRegistrar.GetWebResourceUrl(Page, typeof(Hew.Web.UI.Skins.RadAjaxLoadingPanel), DataBinder.Eval(((GridDataItem)Container).DataItem, "Ajax").ToString()) %>'
                alt="Not found"></img>
        </ItemTemplate>
    </telerik:GridTemplateColumn>


    Hope it helps.

    Greetings, Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  15. 35DDB320-43E8-466D-9FEF-CD0E09AD4780
    35DDB320-43E8-466D-9FEF-CD0E09AD4780 avatar
    120 posts
    Member since:
    Sep 2009

    Posted 18 Jan 2012 Link to this post

    Your fix works for showing the custom skin graphics. However, the "Default" skin that is part of Telerik.Web.UI no longer shows any graphics. It is the only one of all the skins (plus custom skin) that ends up with a "Not Found" in place of the graphic.
  16. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 18 Jan 2012 Link to this post

    Certainly - it is in the Telerik.Web.UI assembly. You need to retrieve it from there.

    All the best, Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  17. 35DDB320-43E8-466D-9FEF-CD0E09AD4780
    35DDB320-43E8-466D-9FEF-CD0E09AD4780 avatar
    120 posts
    Member since:
    Sep 2009

    Posted 18 Jan 2012 Link to this post

    I guess I am not getting how to pull from 3 different assemblies. I have added the "Telerik.Web.UI" as an assembly

    <telerik:RadSkinManager runat="server" ID="RadSkinManager1" ShowChooser="true">
         <Skins>
            <telerik:SkinReference Assembly="Hew.Web.UI.Skins" />
            <telerik:SkinReference Assembly="Telerik.Web.UI" />
        </Skins>
    </telerik:RadSkinManager>

    The codebehind is
    string skinName = skinManagerCombo.Items[i].Text;
      
    if (skinName == "Blue")
    {
        otherSkins = "Hew.Web.UI.Skins";
    }
    else if (skinName == "Default")
    {
        otherSkins = "Telerik.Web.UI";
    }
    else
    {
        otherSkins = "Telerik.Web.UI.Skins";
    }

    The only problem is the resource pathing is incorrect for the Default skin. Your decompiler shows the path as Telerik.Web.UI.Skins.SkinName, the same as in the Telerik.Web.UI.Skins.dll. If I remove your coding suggestion in the markup, the Default skin shows but the custom doesn't. Suggestions?
  18. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 20 Jan 2012 Link to this post

    Hello Dennis,

    Certainly you cannot pull from the three different assemblies in the aspx mark-up, but you can do so in code-behind. The default skin is in the Telerik.Web.UI.dll. I'd advice you to pull the resources first, construct a data object that holds them and pass those to the grid's DataSource property in the NeedDataSource event.

    All the best, Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  19. B3FD0541-F380-43D8-AE5A-37DA912E6719
    B3FD0541-F380-43D8-AE5A-37DA912E6719 avatar
    12 posts
    Member since:
    Mar 2012

    Posted 04 Apr 2012 Link to this post

    Hi Telerik,
                           We are using the RadGrid control in most of the .aspx pages. We have created a global skin file named "Default.skin" where we have created a Structure of the grid with default properties.

    Please find the below code :-

    <telerik:radgrid Width="98%" SkinID="RadGrid" runat="server" allowpaging="true" allowsorting="true"

     allowfilteringbycolumn="true" autogeneratecolumns="False" enablelinqexpressions="False"

     gridlines="None" pagesize="10" allowautomaticinserts="false" allowautomaticupdates="false"

     allowautomaticdeletes="false" allowrowselection="true" >  

     </telerik:radgrid>


    By using the SkinID="RadGrid", we have accessed in the .aspx pages to apply the default properies for a RadGrid control.

    .aspx code:-

    <telerik:RadGrid ID="radGridsample" runat="server" SkinID="RadGrid" DataSourceID="objContGridClients"

    ="objContGridClients"

    </telerik:RadGrid>

    I am not able to apply the default properties specified in the Skin file to the RadGridControl, while i am trying to access the skin from the Assembly.

    Please advice..

    Regards,
    Subbu

  20. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 06 Apr 2012 Link to this post

    Hi,

    There is no a "RadGrid" skin in the telerik assemgly, are you using a custom skin in an assembly of yours?


    Greetings,
    Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  21. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 06 Apr 2012 Link to this post

    Hi,

    There is no a "RadGrid" skin in the telerik assemgly, are you using a custom skin in an assembly of yours?


    Greetings,
    Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  22. B3FD0541-F380-43D8-AE5A-37DA912E6719
    B3FD0541-F380-43D8-AE5A-37DA912E6719 avatar
    12 posts
    Member since:
    Mar 2012

    Posted 06 Apr 2012 Link to this post

    Yes its our own .skin file which we have developed.

    Regards,
    Subbu
  23. B3FD0541-F380-43D8-AE5A-37DA912E6719
    B3FD0541-F380-43D8-AE5A-37DA912E6719 avatar
    12 posts
    Member since:
    Mar 2012

    Posted 09 Apr 2012 Link to this post

    Hi Tsvetoslav,

                         Any updates please..

    Regards,
    Subbu
  24. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 09 Apr 2012 Link to this post

    Hi Sarulatha,

    How come it is "our own" file and at the same time it is you who have developed it? I don't understand, please clarify the issue.


    Regards,
    Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  25. B3FD0541-F380-43D8-AE5A-37DA912E6719
    B3FD0541-F380-43D8-AE5A-37DA912E6719 avatar
    12 posts
    Member since:
    Mar 2012

    Posted 10 Apr 2012 Link to this post

    Hey Tsvetoslav,

          dont want any confusion, i will make it clear.  We have not used any telerik Custom skin file. We have created the .skin file and i have attached the same for reference. By using the SkinID we have referenced in all the .aspx page which consist of Radgrid to apply the same properties,.

    Previously we were referring all the .css,Images and .skin file in App_Themes folder, now we have moved it to a seperate class library project.

    i am able to access the .css,Images and .skin file from App_Themes folder, For the same i am not able to access only the .skin file throgh assembly. The properties of the grid is not applied when i am accessing through assembly.

    Please advice.


    Regards,
    Subbu
  26. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 11 Apr 2012 Link to this post

    Hello Sarulatha,

    Thanks for the clarification.

    When using custom skins for our controls what you need is the Skin property and not the SkinID one and I still wonder how you have managed to get it going with this approach:
    http://www.telerik.com/help/aspnet-ajax/introduction-themes-how-to.html

    Anyhow, now that you have the resources in an assembly of yours, it is only natural that the framework fails to load them as it is not aware of their location. Furthermore, I am afraid you have taken the wrong approach to employing a custom skin to RadGrid embedded in an assembly of yous.

    Please, go throught the following help articles that explain both how to develop a custom skin, how to embedded in a custon skin assembly and  how to take out from their through the RadSkinManager control and apply it to RadGrid:
    http://www.telerik.com/help/aspnet-ajax/introduction-create-custom-skin.html
    http://www.telerik.com/help/aspnet-ajax/introduction-skins-external-assembly.html
    http://www.telerik.com/help/aspnet-ajax/radskinmanager.html#Section4

    Hope it helps.

    Regards,
    Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  27. 164F68E1-8CE3-4BF9-B0EC-59D60DC87BE3
    164F68E1-8CE3-4BF9-B0EC-59D60DC87BE3 avatar
    217 posts
    Member since:
    Apr 2010

    Posted 09 Oct 2012 Link to this post

    Hi,

    I  am trying to use custom skin for  the web application by creating an external assembly.  I  strictly followed the steps  mentioned by Telerik Admin, I tried by giving  different name to the assembly like  "Telerik.Web.UI.Skins.dll" and "M4CustomSkin" but  none of these method  worked.

    Every time, it is taking default black and white  skin color. 

    Am I missing something, can someone point me in the right direction?

    Thanks,
    Prava

     









    Thanks,
    Prava
  28. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 11 Oct 2012 Link to this post

    Hi Prava,

    Please, send your project files as an attachment - it's difficult to say if you have missed something without looking at the actual implemenation. Thanks for the cooperation.

    Regards, Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  29. 164F68E1-8CE3-4BF9-B0EC-59D60DC87BE3
    164F68E1-8CE3-4BF9-B0EC-59D60DC87BE3 avatar
    217 posts
    Member since:
    Apr 2010

    Posted 11 Oct 2012 Link to this post

    Hi Tsvetoslav,
     After few changes here and there, I was able to use custom skin by setting the skin  value for individual controls in aspx page.
     I would like to use the skin at the application level, I  want  the flexibility to use either the custom skin/regular telerik skin.

    Previously, I had stored the theme build by style builder in  app-themes folder and it worked great in Firefox and chrome except for the IE. For this, I had added following settings in webconfig as shown below.

     <appSettings>
      <add key="Telerik.EnableEmbeddedSkins" value="false"/>
         <add key="Skin" value="WebBlue"/>
        <add key="Telerik.Button.Skin" value="M4"/>
        <add key="Telerik.Calendar.Skin" value="M4"/>
        <add key="Telerik.ColorPicker.Skin" value="M4"/>
        <add key="Telerik.ComboBox.Skin" value="M4"/>
        <add key="Telerik.DatePicker.Skin" value="M4"/>
        <add key="Telerik.Dock.Skin" value="M4"/>
        <add key="Telerik.FormDecorator.Skin" value="M4"/>
        <add key="Telerik.Grid.Skin" value="M4"/>
         <add key="Telerik.Scheduler.Skin" value="M4"/>
        <add key="Telerik.Splitter.Skin" value="WebBlue"/>
        <add key="Telerik.TabStrip.Skin" value="Outlook"/>
            
        
      </appSettings>


    I want to build external assembly for custom skin  and use it at application level, is it possible to do that? If yes, how can I do that?
    Thanks,Prava


  30. 2CDCC476-2BD2-4055-9C53-C483073765A0
    2CDCC476-2BD2-4055-9C53-C483073765A0 avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 15 Oct 2012 Link to this post

    Hello Prava,

    Please, refer to the following forum discussion on how to solve your problem:
    http://www.telerik.com/community/forums/aspnet-ajax/form-decorator/want-to-define-global-skin.aspx

    Regards, Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.