- Home
- Forum
- ASP.NET MVC
- User Changed Themes At Runtime
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,
Nate
SIGN IN To post a reply.
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:
|
<Dropdown>
@Html.EJ().DropDownList("DropDownList1").Datasource((IEnumerable<object>)ViewData["LocalDataSource"]).DropDownListFields(Df => Df.Text("Text")).ClientSideEvents(e=>e.Change("change"))
<GRID>
@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging() /*Paging Enabled*/
.SelectionType(SelectionType.Single)
.AllowResizing()
.AllowFiltering()
.Columns(col =>
{
. . .
}))
</div>
<Change Event>
<script>
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
}
</script>
|
Note: The corresponding content folder will be in following structure.
Structure:
Regards,
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.
We are happy that the provided solution working fine at your end.
Please let us know if you need any further assistance.
Regards,
Regards,
Prasanna Kumar N.S.V
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
NG Nate Greene
- Sep 26, 2016 07:31 PM UTC
- Sep 28, 2016 04:42 AM UTC