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

ASP.NET MVC Dynamically Switch Themes

1 Answer 94 Views
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 05 Sep 2019, 06:11 PM

     Hello,

I am  new to MVC and Telerik. I am trying to devise a way to globally change themes (both those that come with Kendo in the C:\Program Files (x86)\Progress\Telerik UI for ASP.NET MVC R2 2019\styles folder and ones created via the SASS Theme builder.

I see the "Change Themes" drop down list at: https://demos.telerik.com/aspnet-mvc/dropdownlist 

and the https://docs.telerik.com/kendo-ui/styles-and-layout/change-themes-on-the-client

but I am curious as to how we would go about creating a dynamic list of all the themes that come with Telerik and all user created sass themes and apply them globally for a user AND be able to save that theme so it is loaded for a user and applied every time they visit the site and the ability to change the theme and save

that preference at anytime. Thoughts?

Thanks,

1 Answer, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 09 Sep 2019, 02:38 PM

Hi Jonathan,

Different approaches can be applied to achieving the desired functionalities. Below you will find suggestions for possible implementation  

  • Generating a list of all the themes that come with Telerik and all user-created SASS themes:
    1. Dynamically build a JSON file with all available themes and their paths on the server.
    2. Use the JSON file for populating the theme-choosing DropDownList visible for the user.
    3. Use the approach demonstrated in the linked example and re-load the different themes. 
    • Save a theme and load it for a given user - this can be implemented by storing the theme for each of the users in a database and load it on user log-in. The loading of a given theme for each user is a custom logic which implementation again depends on the developer's approach.  

    The above suggestions are general but the asked questions are not directly related to the usage of UI for ASP.NET MVC. Their implementation depends on custom logic which can be realized in different ways. 

    You can try implementing the functionality discussed above. If you meet issues, you can send me a runnable project and based on the logic in it I can guide you further.

    Regards,
    Petar
    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.
    Asked by
    Jonathan
    Top achievements
    Rank 1
    Answers by
    Petar
    Telerik team
    Share this question
    or