We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

User Changed Themes At Runtime

My entire site is set to the bootstrap theme, is it possible to set something up that allows the user to select what theme they want to use while using the site through a dropdown list that contains premade themes made available through the standard set that is offered from Syncfusion for most of its components including the grid.

Thanks for any help at all,


3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team September 27, 2016 01:58 PM UTC

Hi Greene, 
Thanks for contacting Syncfusion support. 
We created a sample and in this sample we have rendered the dropdown control with data source and dropdown data source value is based on the Grid theme name (eg. flat-saffron, flat-lime, etc.). If we change the theme name, then the corresponding theme will appear in the Grid.  
Refer to the code example and sample,    
Code example:  
   @Html.EJ().DropDownList("DropDownList1").Datasource((IEnumerable<object>)ViewData["LocalDataSource"]).DropDownListFields(Df => Df.Text("Text")).ClientSideEvents(e=>e.Change("change"))  
         .AllowPaging()    /*Paging Enabled*/  
       .Columns(col =>  
          . . .              
<Change Event>  
    function change(args) {  
        var link = window.document.getElementsByTagName('link'); //get the link of css file  
        var value = args.value; // get the dropdown value  
        $(link).attr('rel='nofollow' href'"/Content/ej/web/" + value + "/ej.web.all.min.css") // Change the theme  
Note: The corresponding content folder will be in following structure.   
Prasanna Kumar N.S.V 

NG Nate Greene September 27, 2016 10:23 PM UTC

Works great thanks for the help!

PK Prasanna Kumar Viswanathan Syncfusion Team September 28, 2016 04:42 AM UTC

Hi Greene,
We are happy that the provided solution working fine at your end.
Please let us know if you need any further assistance.
Prasanna Kumar N.S.V 

Live Chat Icon For mobile
Up arrow icon