ASP.NET MVC Dynamically Switch Themes

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    3 posts
    Member since:
    Mar 2019

    Posted 05 Sep Link to this post

         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,

  2. Petar
    Admin
    Petar avatar
    112 posts

    Posted 09 Sep Link to this post

    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.
    Back to Top