Reputation: 77
I'm trying to write a code that has to be conform certain rules. Currently i'm working on a part that looks a bit like this:
<head><link rel="stylesheet" href="Site.css"></head>
<div class="row">
<div class="col-md-12">
@(Html.Kendo()
.Grid<ViewModel>()
.Name("currentGrid")
.HtmlAttributes(new { style = "width: 100%; height: 640px;", @class = "gridMenu" }))
</div>
</div>
This works fine as it is, but the fact that I'm defining a new style is bothering me. Is there any way to make this reference a style in a css-file? So instead of
.HtmlAttributes(new {style = ...
Something like
.HtmlAttributes(id = currentGrid
Where currentGrid would be the id or class in the css-file.
Any help or questions are more than welcome.
Upvotes: 1
Views: 442
Reputation: 18182
You are close. You can add css for GridId
#currentGrid{
width: 100%;
height: 640px;
}
Or
you can add a class and add styling for the class. Following statement adds a new class for existing grid.
.HtmlAttributes(new {@class = "gridmenu"})
.gridmenu{
width: 100%;
height: 640px;
}
Upvotes: 1